Re: Serveral forms in a page.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 4/25/06, William Stokes <kalles@xxxxxxxxxxxxx> wrote:
> Hello,
>
> This "might be" more HTML stuff but anyway...
>
> I have several forms in a page which is ok otherwise but the reset buttons
> doesn't clear anything that is queried from DB and printed to the text
> fields. Any idea how to create Reset buttons that clear the fields even when
> the data is not from user input? Or do I have to create reset buttons that
> are actually submit buttons and play with variables after that or something
> like that? Javascript is the way I don't want to go...

The reset button restores the form back to it's original state - if
you preload values or preselect options when you display the form,
then that's what it will reset it back to.

<form>
Blah: <input type="text" name="blah" value="12345">
<input type="reset" value="Reset">
</form>

Change 'blah', hit 'reset' and it will change it back to 12345.

If you want to completely reset the form, then you'll have to either
use javascript or refresh the page with a flag and check..

<?php
if (isset($_GET['clearform'])) {
  $blah = '';
} else {
  $blah = '12345';
}
?>

<form>
Blah: <input type="text" name="blah" value="<?php echo $blah; ?>">
<input type="reset" value="Reset">
</form>

--
Postgresql & php tutorials
http://www.designmagick.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux