Page 1 of 1
mysql and php text formatting problem
Posted: Thu Jan 21, 2010 9:05 am
by mayanktalwar1988
hey i have just created databse and i will extract information through it with php..but the problem is that.when i submit data in paragraph form..php truncate the spaces in between two paragraphs..and dispaly it as one paragraph as a whole..i just want that the format in which the data was submitted and the format in which the data will be extracted out should be the same while dispalying what can be done for this...
Re: mysql and php text formatting problem
Posted: Thu Jan 21, 2010 10:08 am
by requinix
mayanktalwar1988 wrote:hey i have just created databse and i will extract information through it with php..but the problem is that.when i submit data in paragraph form..php truncate the spaces in between two paragraphs..and dispaly it as one paragraph as a whole..i just want that the format in which the data was submitted and the format in which the data will be extracted out should be the same while dispalying what can be done for this...
PHP didn't do anything. You're getting exactly what you put in.
Take your complaint to the W3C. They're the ones who said that multiple whitespace, which includes spaces and newlines, are normally collapsed to one single space.
You can use
nl2br to convert the newlines to HTML line <br>eaks.