php-general | 2003022
Date: 02/20/03
- Next message: William S.: "[PHP] passing content of file as argument"
- Previous message: Jesse Guardiani: "Re: [PHP] TrueType + GD (ImageTTFBox)"
- In reply to: Tom Rogers: "Re: [PHP] Display strings with single quotes"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> Thursday, February 20, 2003, 9:34:03 PM, you wrote:
> Rec> Hi all,
>
> Rec> Have simple but annoying issue, I want to display a string
within an
> Rec> input field. This string contains ' & so when it's being display the,
> Rec> anything after the ' is being left out. Here is the code I'm using:
>
> Rec> $string = str_replace("'", "''", $string);
> Rec> $string = stripslashes($string);
> Rec> echo "<input type=text name='value' size=20 value =
'$string'>";
>
> Rec> Thanks
> Rec> Dave
>
>
> You could also try
>
> echo '<input type="text" name="value" size="20" value="'.$string.'">';
> which would be more politically correct :)
Good point. You'll still run into problems if $string has double quotes
within it, though. So the original suggestion of using htmlentities() still
applies.
---John Holmes...
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
- Next message: William S.: "[PHP] passing content of file as argument"
- Previous message: Jesse Guardiani: "Re: [PHP] TrueType + GD (ImageTTFBox)"
- In reply to: Tom Rogers: "Re: [PHP] Display strings with single quotes"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

