urlencode and quotes HELP needed
| From: | Shane McBride | Date: | Sat, 21 Oct 2000 21:40:52 +0000 |
| Subject: | urlencode and quotes HELP needed | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-21592@lists.php.net to get a copy of this message | ||
I have a form that I am passing the value of a drop-down (<select> tag) menu variable to
another php page. The current form works well, except when the variable has quotes in it, like Aqua
Relief 6" x 12". When this happens the variable would go to the second page as Aqua
Relief.
At first I thought the problem was with the way I had the variable coded on the second page, but
after further investigation, it appears that the POST method is not passing the variable through as
I had expected.
So, I have tried to figure out what I need to do. This is what I have so far (that FAILS ALL the
time):
echo "
<select name=sel_record">
<option value=\"\"> -- Select an Item -- </option>
";
while ($row = mysql_fetch_array($sql_result)) {
$title = $row["title"];
$price = $row["price"];
$image = $row["image"];
$fmt_price = sprintf("%0.2f", $price);
echo "
<option value=\"$title\">$title</option>
";
}
echo "</select><input type=\"hidden\" value=\"$title\"
name=\"title\"><input type=\"hidden\"
value=\"$image\"name=\"image\">";
}
$fmt_sel_record = urlencode($sel_record);
What do I need to do to get the fmt_sel_record varialble to encode correctly?
TIA,
Shane