forms - text to html on submission

They have: 1 posts

Joined: Feb 2006

hi all

what I'm trying to do is get a comments form that submits to a database to convert the main comment to html.

At the moment any comments submit end up being just 1 big paragraph even if the user hit enter a of times.

like this topic shows up like i type it if i had done this on my system it would be like this
-----------------------------------------------------------------
what I'm trying to do is get a comments form that submits to a database to convert the main comment to html.At the moment any comments submit end up being just 1 big paragraph even if the user hit enter a of times.
---------------------------------------------------------------------

any help with this matter would be grateful.

Busy's picture

He has: 6,151 posts

Joined: May 2001

What are using using for database etc, PHP/MYSQL, ASP/SQL .... ?

most text gets put as one long sentence unless you include nl2br() or similar

Let us know what your using and should be able to help further

He has: 31 posts

Joined: Jan 2004

thanks dude im using php/mysql.....thanks for your help im not if its the form or the db thats does this mod..

ps. i just found my old login.

Busy's picture

He has: 6,151 posts

Joined: May 2001

If it's just the lines your worried about use nl2br(), will add a (or ) where the \n (newline) is.

$content_from_form_after_validation = nl2br($content_from_form_after_validation);

or you could use it as part of it, like strip slashes, convert htmlspecialcharacters() ..

He has: 31 posts

Joined: Jan 2004

ok confused sorry.. to be hoonest im surprised i manedge to do this so far.. loll and its working kind of.

i have just been trying to find out about nl2br but even though it would work how would i include it in a form? it shows you how to include it in sendmail forms but thats it.
this is a page of one of my submission pages with the theme removed. where and what exsactly would i put for nl2br to work?
-----------------------------------------------------------------

doh that was two minutes ago.. figured it out it not the form it the message on display..

thankyou very much..

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.