Re: Text data truncated after first blank character in form fields
| From: | Ernest E Vogelsinger | Date: | Mon, 17 Feb 2003 22:34:49 +0000 |
| Subject: | Re: Text data truncated after first blank character in form fields | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-135914@lists.php.net to get a copy of this message | ||
At 22:04 17.02.2003, Michael Eacott said:
--------------------[snip]--------------------
>When I have the following in a form:
><?php $testvar = "a b c"; ?>
><input type="text" size=20 name=testvar value=<?php echo $testvar; ?>>
>the value shown in the form field is a and not a b c
>why?
>and how can I get to see the untrucated text, please?
--------------------[snip]--------------------
You should always place quotes around the "Value" parameter;
<input type="text" size=20 name=testvar value="<?php echo $testvar;
?>">
Additionally you should always htmlencode the value parameter:
<input type="text" size=20 name=testvar
value="<?php echo htmlentities($testvar); ?>">
--
>O Ernest E. Vogelsinger
(\) ICQ #13394035
^ http://www.vogelsinger.at/