Escaped Apostrophes and Quotes
| From: | Rick Emery | Date: | Thu, 15 Feb 2001 16:40:06 +0000 |
| Subject: | Escaped Apostrophes and Quotes | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-6661@lists.php.net to get a copy of this message | ||
My PHP output displays escaped apostrophes and quotes. Given the following
example FORM and PHP3 script:
index.html ==============
<HTML>
<HEAD></HEAD>
<BODY>
<FORM method="post" action="http://www.somedomain.com/myscript.php3">
Enter data:
<INPUT type="text" name="mydata"><BR>
<INPUT type="submit" name="submit" value="Submit">
</FORM>
</BODY>
</HTML>
myscript.php3=====================
<HTML>
<HEAD></HEAD>
<BODY>
<?php
print $mydata;
?>
<BR>
</BODY>
</HTML>
======================
In the text field, if the user enters: I'm
the the following is displayed by the PHP script: I\'m
I've tried the following, with variations:
print "$mydata";
print '$mydata';
echo $mydata;
echo "$mydata";
printf ("%s",$mydata);
I've tried: ereg_replace("\\","",$mydata);
All have been unsuccessful on the web host that I use, which is Apache with
PHP 3
That said, on another Apache server with PHP 3, I get the output I want and
expect. That is, no back-slash precedes the apostrophe or quote.
What do I need to do to eliminate the back-slash?
thanks
Richard L. Emery
IT Sr. Project Manager