RE: [PHP] Strings in text fields are bad
| From: | Maxim Maletsky | Date: | Tue, 26 Sep 2000 04:02:49 +0000 |
| Subject: | RE: [PHP] Strings in text fields are bad | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-17510@lists.php.net to get a copy of this message | ||
Stop, Stop, Stop Guys ...
Why not to teach this guy doing it simplier:
$caddress = '12345 Abc Ave.';
echo '<input type=text name=caddress value="' . $caddress .
'">';
Use always single quotes when you have a variable to put into an html. Then
the only thing to escape will remain enother single quote.
$foo = 'is';
so, not anymore "my url to <A href=\""$foo"\">$foo is here";
but
so, not anymore 'my url to <A href="' . $foo . '">' . $foo .
'</a> is here';
easier for HTML but harder for strings containing many variables.
BTW single quotes are also some faster since they do not have to be parsed
by PHP.
-----Original Message-----
From: Toby Miller [mailto:tmiller@creativegeneration.com]
Sent: Tuesday, September 26, 2000 12:51 PM
To: Tyler Longren; PHP-General
Subject: Re: [PHP] Strings in text fields are bad
Tyler,
The problem is not with PHP. It's with your HTML. Try this:
$caddress = "12345 Abc Ave.";
echo "<input type='text' name='caddress'
value='$caddress'>";
Toby
At 01:49 AM 9/26/00, Tyler Longren wrote:
>Hello everybody,
>
>When i do this:
>$caddress = "12345 Abc Ave.";
>echo "<input type=text name=caddress value=$caddress>";
>
>Why does it only print out the '12345' part of $caddress into the text
>field? It's very important that it prints all of it in there. I suppose
>this has something to do with the form field. Does it not like spaces?
>
>Regards,
>Tyler Longren
>
>
>--
>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
--
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