Jump to content

HTML forum format input to


Daguse

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.
Link to comment
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\" /]
Link to comment
Share on other sites

  • 2 weeks later...
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!
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.