Page 1 of 1

Problems with form entry and database retrieval

Posted: Wed Dec 13, 2006 2:29 pm
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

Posted: Wed Dec 13, 2006 2:31 pm
by feyd
You're supposed to use nl2br() on the data after it's retrieved from the database.

Posted: Fri Dec 15, 2006 8:21 am
by lettie_etetra
Doh! Cheers feyd.