Problems with form entry and database retrieval

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
lettie_etetra
Forum Newbie
Posts: 3
Joined: Wed Dec 13, 2006 2:00 pm

Problems with form entry and database retrieval

Post by lettie_etetra »

Hi chaps

Not new here just can't get access to my account and need a quick response.

Have a form with textarea that submits to a mySql db. Have used the method I have used before to collect form data and publish it to the live site via CMS system. Problem I'm having now is when you enter content in the form field and use carriage returns. Somewhere along the line they are getting lost. I previously used a br2nl function to correct extra spacing but for some reason now the data is being sent to the database ok but when retriving with a mySql query and echoing the output none of the line breaks are kept and it is amalgamated into one large paragraph. Even if I add html tags to the textfield and use htmlentities the echo statement just prints out the data as text instead of rendering the html. I've done some digging and the only thing I can make out that is different is the type of database I'm using. The previous one was a MyISAM one but the new one is an InnoDB. Would this make a difference. Or can anyone suggest another reason why this is now not working.

Many Thanks

Cheers
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

You're supposed to use nl2br() on the data after it's retrieved from the database.
lettie_etetra
Forum Newbie
Posts: 3
Joined: Wed Dec 13, 2006 2:00 pm

Post by lettie_etetra »

Doh! Cheers feyd.
Post Reply