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...

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

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

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...

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.