Re: addslashes Question
| From: | Tobias Talltorp | Date: | Wed, 21 Mar 2001 22:14:26 +0000 |
| Subject: | Re: addslashes Question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-45009@lists.php.net to get a copy of this message | ||
This seems to be more of a HTML problem.
Form fields simply can´t print out ". You need to change the " to " in
order for it to appear.
This can be done using the function htmlspecialchars():
http://www.php.net/manual/en/function.htmlspecialchars.php
In your case:
<?php echo htmlspecialchars("$desc1"); ?>">
You can test these two things to see the difference:
1. <input type="text" name="name" value="this has a "">
2. <input type="text" name="name" value="this does not have a
"">
// Tobias
""Jeff Oien"" <jeff@webdesigns1.com> wrote in message
news:NDBBJKNCILKDCEGAJBAOIEBGDIAA.jeff@webdesigns1.com...
> I have a form to modify a record in a MySQL database.
> The record contains this:
> 3" Brush
> The code in question is like this:
> while ($row = mysql_fetch_array($result)) {
> $desc1 = $row['desc1'];
> ------
> <input type="text" name="desc1" value="<?php echo
> "$desc1"; ?>">
>
> I've tried using addslashes to the variable in various ways and it
> always returns:
> 3\
> What am I doing wrong? Sorry this is probably the 1000th time
> this has been asked.
> Jeff Oien
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>