-1

I have a textfield in html. I catch data from the textfield using $_POST in php and I echo it. Whenever I echo, it automatically reduces multiple whitespaces in between words in a single whitespace. However, I did not use any trim like functions or any other functions just simple $_POST echo. I need the text AS IT IS. No reduction of whitespaces. Even in the stackoverflow, while I am writing this question I tried to put some example. But, even here extra whitespaces have been reduced to one whitespace. How to do this? TIA

user373100
  • 31
  • 4
  • That is HTML. Use `
    ` tag
    – Andreas Nov 21 '18 at 04:18
  • That is how browsers have always render multiple whitespaces. Encode them as entities. Maybe https://stackoverflow.com/questions/433493/why-does-html-require-that-multiple-spaces-show-up-as-a-single-space-in-the-brow is a good dup – user3783243 Nov 21 '18 at 04:18
  • That's how they are rendered but you still have your white spaces. use urlencode({string}); and you will see + where the white spaces were rendered out – comphonia Nov 21 '18 at 04:21

1 Answers1

0

The answer is, just use <pre> tag.

Pang
  • 9,564
  • 146
  • 81
  • 122
user373100
  • 31
  • 4