Re: Keeping form fields populated

From: Date: Thu, 15 May 2003 22:12:31 +0000
Subject: Re: Keeping form fields populated
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-147830@lists.php.net to get a copy of this message
On Thu, 2003-05-15 at 18:01, Steve Keller wrote: > At 5/15/2003 05:48 PM, Brian V Bonini wrote: > > So, I guess what I need to do is have reset reload the form (which I > > know how) and empty out all the $vars... ??? > > You can't. At least, not permanently. You can use Javascript to "empty" the > fields, but if the user refreshes, all the values would come back. Instead of > > <input type="reset"> > > You would use > > <input type="button" > onClick="document.myForm.myFieldName.value='';" > value="Clear"> > > Or, if you want to clear out everything, then you have the javascript null > the values and then submit the form. I ended up creating a second Submit button <input type="submit" name="reset" value="Reset"> had it submit back to the page and then do this: if(isset($_POST["reset"])) { while(list($k, $v) = each($_POST)) { unset($_POST[$k]); } } But I'm gonna try with JS too.

« previous php.general (#147830) next »