note 45063 deleted from function.addslashes by aidan
| From: | aidan@php.net | Date: | Thu, 09 Sep 2004 02:04:22 +0000 |
| Subject: | note 45063 deleted from function.addslashes by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-76259@lists.php.net to get a copy of this message | ||
Note Submitter: david at wdsincorporated dot com
----
If you want to display quoted information in a text input element's VALUE field, addslashes, as
noted before, will not work. Instead you can use str_replace to substitute in the ISO entity for
right quote ’
For example
// This doesn't display correctly is a single quote is in there
$myform = "<input type='text' name='mytext' value='" .
$_POST['myvar'] . "'>;
echo $myform;
// This does
$myform = "<input type='text' name='mytext' value='" .
str_replace("'","&rsquot;", $_POST['myvar']) .
"'>";
echo $myform