View Single Post
Old 06-25-2007, 02:49 PM   #2 (permalink)
Vormund
 
Monster Techie

Join Date: May 2004

Location: Tucson, AZ, USA

Posts: 1,183

Vormund

Send a message via AIM to Vormund Send a message via MSN to Vormund Send a message via Yahoo to Vormund
Default Re: Allowing HTML in PHP/MySQL posts?

You can use addslashes( ) to make any input safe for comparisons/queries etc., such as:
$comment = addslashes( $_POST['comment'] );
...and then using stripslashes( ) when outputting the content later on.

A thing to note, when typing in (this) text box, line breaks are the invisible newline character, \n, so you'd need to replace them with <br/>:
$subject = str_replace( "\n", "<br/>", $subject );
__________________
Vormund is offline