mysql and php text formatting problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mayanktalwar1988
Forum Contributor
Posts: 133
Joined: Wed Jul 08, 2009 2:44 am

mysql and php text formatting problem

Post 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...
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: mysql and php text formatting problem

Post 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.
Post Reply