Re: presenting a failed form for re-entry.
| From: | Robin Vickery | Date: | Thu, 07 Sep 2000 11:14:02 +0000 |
| Subject: | Re: presenting a failed form for re-entry. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-15692@lists.php.net to get a copy of this message | ||
peter_sands@my-Deja.com (" ") writes:
> hello,
> I have created a form with various input fields,
> a php script then validates these fields.
> What I want to do is present the original form with say a '*', against the failed
> fields. What is the best way to do this ?.
Something like this maybe?
<?php
if (isset($validate))
{
foreach($HTTP_GET_VARS as $field => $value)
{
if (empty($value)) { $mark[$field] = '*'; }
}
}
?>
<form>
<input name='foo' value='<?=$foo;?>'>
<?=$mark['foo'];?> <br>
<input name='bar' value='<?=$bar;?>'>
<?=$mark['bar'];?> <br>
<input name='baz' value='<?=$baz;?>'>
<?=$mark['baz'];?> <br>
<input type='submit' name='validate' value='Validate'>
</form>
--
Robin Vickery...............................................
Planet-Three, 3A West Point, Warple Way, London, W3 0RG, UK
Email: robin@planet-three.net Phone: +44 (0)870 729 5444