Zuber Surya
Zuber Surya

Reputation: 869

Cakephp2.0 is removing extra spaces from data received from mysql

I have information saved in mysql database

Input given

$name = 'This is the sample                      data'

Actually getting output which is not required

 $name = 'This is the sample data' 

Desired Output

$name = 'This is the sample                      data'

while retrieving from database I can see using PR() which is also fine but while echo $name it removes extra spaces which is not required.

Upvotes: 1

Views: 89

Answers (1)

Arjan
Arjan

Reputation: 9874

Browsers collapse white space in html. That means two or more spaces are always collapsed to one. If you really need to display the text as is, use the <pre> tag:

<pre>This is the sample                      data</pre>

This tells your browser that the text is preformatted.

Upvotes: 3

Related Questions