Re: Truncated values in update form

From: Date: Tue, 20 May 2003 15:07:48 +0000
Subject: Re: Truncated values in update form
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-148288@lists.php.net to get a copy of this message
> I made an update form where I would like to show the values to be updated. > However, the values e.g. $fname and $lname truncate at the first space. > How can I do to show the whole value? > "Name<input type=text name=fname value=$fname><br>" . > "Surname<input type=text name=lname value=$lname><br>" . Look at your source code... (for example) <input type=text name=name value=John Holmes> How do you expect HTML to know that you mean for "John Holmes" to be the name? It sees "John" as the value and "Holmes" as an unknown attribute that it ignores (HTML is forgiving that way). So, to solve your problem, put quotes around your values... <input type="text" name="name" value="$fname"> To answer your next question when you eventually will need to display a value with a quote in it: <input type="text" name="name" value="some "value" okay"> You should use htmlentities() on the variable before you place it into the value attribute. It will make the above look like: <input type="text" name="name" value="some &quote;value&quote; okay"> It will appear in the text box as actual quotes, though, not HTML entities. Hope that helps. ---John Holmes...

« previous php.general (#148288) next »