Jump to content

Archived

This topic is now archived and is closed to further replies.

Daguse

HTML forum format input to

Recommended Posts

Ok I need to take a block of text from a HTML forum textarea and save it as is, with line breaks and all. Now I already use htmlentities() but it does not save the line breaks. I am going upload this to a mysql DB. How would I do this. Thanks for your help.

Share this post


Link to post
Share on other sites
[!--quoteo(post=377214:date=May 25 2006, 09:05 PM:name=Daguse)--][div class=\'quotetop\']QUOTE(Daguse @ May 25 2006, 09:05 PM) [snapback]377214[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Ok I need to take a block of text from a HTML forum textarea and save it as is, with line breaks and all. Now I already use htmlentities() but it does not save the line breaks. I am going upload this to a mysql DB. How would I do this. Thanks for your help.
[/quote]
[a href=\"http://www.php.net/nl2br\" target=\"_blank\"]http://www.php.net/nl2br[/a] [img src=\"style_emoticons/[#EMO_DIR#]/wink.gif\" style=\"vertical-align:middle\" emoid=\":wink:\" border=\"0\" alt=\"wink.gif\" /]

Share this post


Link to post
Share on other sites
Thanks, poirot!

nl2br works great, but I have found two more problems.

1st! When I go back to edit the forum I see the <Br/> rather the the line break it self.
To edit it the forum I just set the value to the value from the SQL db. So the script will look like <TEXTAREA>$postmessage</TEXTAREA>. So is there a way to set <br/> to make a line break in the Textarea?


2nd! Is there a way to set up htmlentities() so that I can post image and link tags in HTML formate? So say I post

Check out this "G4 Mailbox" <img src="http://craphound.com/images/g4mailboxauckland.jpg">

how to I set it up so it will post the text with the "" and other HTML thing but still post the image?
When posting I have the post wraped with nl2br() and htmlentities().
[code]$postmessage = nl2br(htmlentities($postmessage))[/code]


I know this is a 2 part post but if any one could please point me in the right derection.

Thank you!
The PHP nub, Daguse!

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.