0

Hi Guys,

I'm having trouble with the form reset button in my php script.
The form submits to it's self in the same page.
The php script has error handling i.e

if(empty($name)){
$error[] = " Enter Your Name";}

The Problem i have is when the form is submitted it checks the errors and the value (if it has passed error handling) is echoed in the form so the user doesn't have to enter all the infomation again. But the reset button doesn't work after the initial submit button. I have looked arounf for the past couple of hours and found nothing to help. I was thinking of calling a js onClick event to unset the fields but i'm unsure of calling php within a js script. There will probably be a simple solution but my head is mashed!!!

Cheers...

2
Contributors
3
Replies
5
Views
7 Years
Discussion Span
Last Post by emhmk1
0

to reset a form you shouldn't use a submit button, instead use:

<input type="reset" value="Reset!">
0

to reset a form you shouldn't use a submit button, instead use:

<input type="reset" value="Reset!">

Thanks, i'm quite aware of that, What i was meaning was
The form is submitted and error handling occurs, if the field passes error checking the value of that field is echoed in the form ie

if (isset($name)){echo " value="$name";}

What i'm wanting to do is delete the value from the form once a reset button is pressed. The reset works before the form is submitted but not after.

Hope that clarifies things!!
Cheers...

0

So.....

After hours of acting like a thick idiot i did a simple

<input type="button" onClick="window.location='mypage.php'" value="Reset" />

and reloaded the page that way....
Thanks for looking.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.