Re: php and texfield values
| From: | Richard Davey | Date: | Tue, 17 Feb 2004 13:17:00 +0000 |
| Subject: | Re: php and texfield values | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-177939@lists.php.net to get a copy of this message | ||
Hello Angelo,
Tuesday, February 17, 2004, 12:52:13 PM, you wrote:
AZ> Say I want to populate a textfield from a resultset and the resultset's
AZ> field has 2 words in it say: mike smith.
AZ> when I echo the value out to the texfields value it only displays mike and
AZ> not mike smith, I cant understand why.
I would suggest tidying up the code a little to make life easier for
yourself. You don't have to have it in-line with the HTML:
<?php
if ($prospects !== "")
{
$value = $row['p_company'];
}
else
{
$value = "";
}
?>
<td><input type="text" name="company"
value="<?=$value?>"></td>
Also if your database entry has quote marks in it, it will break this.
Here is one (of many) ways to solve it:
$value = htmlspecialchars($row['p_company']);
--
Best regards,
Richard Davey
http://www.phpcommunity.org/wiki/296.html