note 45063 added to function.addslashes
| From: | david at wdsincorporated dot com | Date: | Tue, 24 Aug 2004 20:52:44 +0000 |
| Subject: | note 45063 added to function.addslashes | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-75222@lists.php.net to get a copy of this message | ||
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
----
Manual Page -- http://www.php.net/manual/en/function.addslashes.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+45063
Delete -- http://master.php.net/manage/user-notes.php?action=delete+45063&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+45063&report=yes
Search -- http://master.php.net/manage/user-notes.php