Verify form, post and then move to new page

admin

Administrator
Staff member
Help! I've been trying all weekend to get a form on my website to work correctly. All I want it to do is validate what's been entered and then post to an e-mail address and then and only then navigate to the next page. Any suggestions?

Heres what I have so far:

<html>

<head>
<title>Guestbook</title>
<link rel="stylesheet" type="text/css" href=http://www.webdeveloper.com/forum/archive/index.php/"../../css/css.css">


<SCRIPT LANGUAGE="JavaScript">

<!-- Begin
function checkrequired (which) {
var pass=true;
if (document.images) {
for (i=0;i<which.length;i++) {
var tempobj=which.elements;
if (tempobj.name.substring(0,8)=="required") {
if (((tempobj.type=="text"||tempobj.type=="textarea")&&
tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&
tempobj.selectedIndex==0)) {
pass=false;
break;
}
}
}
}
if (!pass) {
shortFieldName=tempobj.name.substring(8,30).toUpperCase();
alert("Please make sure the "+shortFieldName+" field was properly completed.");
return false;
}
else
return true;
}
// End -->

</script>



</head>

<body>


<table border="0" width="100%" bordercolor="#FF0000">
<tr>
<td width="100%">
<p align="center"><font color="#FF0000" face="Arial Black" size="7"><b></b></font></p>
</td>
</tr>
<tr>
<td width="100%">
<H3 align="center"><font color="#000000" face="Times New Roman" size="5">Please Sign In...</font></H3>
<form name =enableform onSubmit="return checkrequired(this)" method="post" action="mailto:">
<p align="center"><font face="Times New Roman" size="4">Forename: <input type="text" name="requiredforename"> Surname: <input type="text" name="requiredsurname">
</font>
</p>
<p align="center"><font face="Times New Roman" size="4">e-Mail: <input type="text" name="requirede-mail"> Age: <select name="requiredagecategory">
<option Selected> Pick an Option!
<option>1: Younger than 15
<option>2: 15-25
<option>3: 26-35
<option>4: 36-45
<option>5: 46-55
<option>6: 56-65
<option>7: 66+
</select>
</font>
</p>
<p align="center"><font size="4" face="Times New Roman">Please comment below</font>
<br>
<textarea name="requiredcomments" rows="6" cols="20"></textarea>
</p>
<p align="center">
<input type=submit value=http://www.webdeveloper.com/forum/archive/index.php/"Submit">
<input type=reset value="Start Over">
</p>
</form>
</td>
</tr>
<tr>
<td width=" align="center" 100%" rows="1" cols="20">
<p align="center">
</p>
</td>
</tr>
</table>

</body>

</html>

Thanks in advance
 
Back
Top