Ok I have googled for hours and found nothing that works. I need help desperately
I have got a form with the following elements in it.
<form action="sendmail.php" method="post" name="enquiry">
<table>
<tr>
<td>Name:-</td>
<td><input type="text" name="name" /></td>
</tr>
<tr>
<td>Company:-</td>
<td> <input type="text" name="company" /></td>
</tr>
<tr>
<td>E-Mail:-</td>
<td><input type="text" name="email" /></td>
</tr>
<tr>
<td>Contact:-</td>
<td> <input type="text" name="contact" /></td>
</tr>
<tr>
<td>Requirement:-</td>
<td><textarea name="msg"></textarea></td>
</tr>
</table>
<input type="submit" value="submit" onclick="return validation(this.form);">
<input type="reset" value="Reset" />
</form>
and the php has a line like this:
<?php
if(mail($to, $subject,$message)) {
echo "<SCRIPT LANGUAGE='JavaScript'>alert('Your Enquiry was sent successfully we will get back to you shortly');
window.location.href='javascript:history.go(-1)';
document.enquiry.reset();
</SCRIPT>";
}
?>
Then there's an "else" with the same code but a different message.
The problem is when it redirects back to the form page it still has the data in the fields. What I prefer is a clean form with no data filled in when the user returns to the page.
Please note I am a newbie to javascript so try suggesting a fix that would be easy to comprehend.
Thanks a lot in advance!