Re: An "escape special characters" problem
| From: | Robert E. Harvey, M.D. | Date: | Sat, 15 Feb 2003 20:12:16 +0000 |
| Subject: | Re: An "escape special characters" problem | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-135698@lists.php.net to get a copy of this message | ||
Jason Sheets wrote:
You're problem is that you are enclosing your value for your <option tags with single quotes ('), when you fetch the value from the database the single quote in 's ends the value='' assignment in your HTML. You can use echo "<option value=\"$algen\">$algen"; which will solve your single quote problem. You could also addslashes on your value and then stripslashes when you want to operate on it, example '<option value="' . addslashes($algen) . '">' . $algen . '">'; That doesn't seem to work. Here's how I'm typing my code. Do you see a problem here?echo '<option value="' . addslashes($algen) . '">"' . ($algen) . '">\n'; or echo "<option value=\"$algen\">$algen\n"; or echo "<option value=\"$algen\">$algen>\n"; Bob