I am having a devil of a time with double quotes. I have a forum on my site that I created and it takes textual input from a text field in a form and stores it in a database. It then displays the data from that field on a web page, just like a web forum might do.
The problem I have is, a customer sometimes puts in a double quotation mark ( " ) and then the output gets skewed.
I want to do two things.
When a customer puts a double quote in their text, I want to strip it out before it gets inserted into the database.
For existing text already there, I want to strip out the double quotes whenever it is displayed.
Here is what I have to format the text thus far....
// TEXT FORMATTING
$theText2 = nl2br($theText2);
$theText2 = ereg_replace("<br />", "", $theText2);
$theText2 = ereg_replace("\r", "", $theText2);
$theText2 = ereg_replace("\n", "", $theText2);
$theText2 = ereg_replace("'", "'", $theText2);
$theText2 = ereg_replace("<wbr>", "", $theText2);
$theText2 = ereg_replace("<wbr>", "", $theText2);
$theText2 = strip_tags($theText2, "<a><b><i><u><br>");
$theText2 = eregi_replace( "'", '"', $theText2 );
I have also tried htmlentities, but with no avail. I have looked far and wide on various forums at various times and I have RTM, but I cannot conquer this problem without assistance.
Thanks in advance.