RE: [PHP] Filling Forms with $variables

From: Date: Wed, 13 Feb 2002 22:13:39 +0000
Subject: RE: [PHP] Filling Forms with $variables
Groups: php.general 
Request: Send a blank email to php-general+get-84669@lists.php.net to get a copy of this message
also remember that strictly speaking, _all_ html attribute values _should_ be quoted -----Original Message----- From: Johnson, Kirk [mailto:kjohnson@zootweb.com] Sent: Thursday, February 14, 2002 9:07 AM To: PHP Subject: RE: [PHP] Filling Forms with $variables Enclose the value in quotes, like so: <input type="text" name="name" value="<?echo "$name";?>"> The browser can't know that "Steven Walker" is all one string unless it is quoted. It thinks the 2nd part of the name after the space is the next attribute, unless it is quoted, i.e., it is seeing value=Steven Walker> Kirk > -----Original Message----- > From: Steven Walker [mailto:steve@walkereffects.com] > Sent: Wednesday, February 13, 2002 2:56 PM > To: PHP > Subject: [PHP] Filling Forms with $variables > > > Hi, > > I'm having trouble setting the value of form elements using variable > values. For example: > > <?$name = "Steven Walker"?> > <form name="form1" method="post" action="infocollect.php"> > <input type="text" name="name" value=<?echo > "$name";?>> > </form> > > In the browser, the name field is only filled with "Steven", > and drops > off everything after the space. If I echo $name outside of > the form it > prints fine. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#84669) next »