RE: [PHP] <input type="text" value="He said, "How do I get this t o work?", with a frown" size="50">
| From: | Vail, Warren | Date: | Wed, 17 Mar 2004 00:05:34 +0000 |
| Subject: | RE: [PHP] <input type="text" value="He said, "How do I get this t o work?", with a frown" size="50"> | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-180625@lists.php.net to get a copy of this message | ||
I caught that one about 10 seconds after pressing the send button. Guess
nothing gets by you guys.
Warren Vail
-----Original Message-----
From: Chris Shiflett [mailto:shiflett@php.net]
Sent: Tuesday, March 16, 2004 3:46 PM
To: Vail, Warren; 'Chris W. Parker'; James E Hicks III;
php-general@lists.php.net
Subject: RE: [PHP] <input type="text" value="He said, "How do I get this
t o work?", with a frown" size="50">
--- "Vail, Warren" <Warren.Vail@schwab.com> wrote:
> Ahh, because it's raw html and not in php.
>
> one choice would be to encapsulate it within php
>
> <input type="text" value="<?php echo "He said, \"How'm I
> gonna get
> this to work?\", with a frown";?>" size="50">
The problem with this is that PHP is server-side, so the following is sent
to the browser:
<input type="text" value="He said, "How'm I gonna get this to
work?", with a frown" size="50">
Thus, the same problem exists on the client-side, because the output is
identical.
To reiterate what others have stated, escaping quotes is good for PHP, and
HTML entities are good for HTML.
Chris
=====
Chris Shiflett - http://shiflett.org/
PHP Security - O'Reilly
Coming mid-2004
HTTP Developer's Handbook - Sams
http://httphandbook.org/
PHP Community Site
http://phpcommunity.org/