Jump to content


Photo

HTML forum format input to


  • Please log in to reply
2 replies to this topic

#1 Daguse

Daguse
  • Members
  • PipPip
  • Member
  • 26 posts

Posted 26 May 2006 - 04:05 AM

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.

#2 poirot

poirot
  • Members
  • PipPipPip
  • Advanced Member
  • 646 posts
  • LocationAustin, TX

Posted 26 May 2006 - 05:06 AM

[!--quoteo(post=377214:date=May 25 2006, 09:05 PM:name=Daguse)--][div class=\'quotetop\']QUOTE(Daguse @ May 25 2006, 09:05 PM) View Post[/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\" /]
~ D Kuang

#3 Daguse

Daguse
  • Members
  • PipPip
  • Member
  • 26 posts

Posted 04 June 2006 - 07:50 PM

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...xauckland.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().
$postmessage = nl2br(htmlentities($postmessage))



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!





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users