You have several things wrong here. the solution depends on your needs.
1) If you don't need an asynk call to mail.php
, just delete the javascript stuff. When you are doing this: <form action="mail.php" method="POST">
All your form inputs will be sent using POST to the selected action, so you dont need to use javascript.
2) If you do need asynk loading of mail.php
you need to do several things in order to work:
- remove all attributes from the form tag:
<form>
- remove
onclick="return false;"
from the submit button tag check yourself the data completion, f.ex.:
var complete = true; if(subject==""||name==""||email=="") { complete = false; } if(complete) { //send post to mail.php } else { alert("You need to fill in all the fields"); }
Keep in mind that not all explorers support this feature: http://www.w3schools.com/tags/att_input_required.asp