PHP Code:
html>
<head>
<script type="text/javascript">
function formSubmit()
{
x=document.forms.myForm
fname=x.firstname.value.replace(/:/g,"")
lname=x.lastname.value.replace(/:/g,"")
var num1=parseInt(fname)
var num2=parseInt(lname)
if (fname<lname){
alert (lname)
return false
}
else if (fname>lname){
alert (fname)
return false
}
else{
return true
}
}
</script>
</head>
<body>
<form name="myForm" action="message5.htm" method="post">
Firstname: <select name="firstname" size="1"> <option>00:00:00</option> <option>00:30:00</option>
<option>01:00</option> <option>01:30</option>
<option>02:00</option></select>
<br />
Lastname: <select name="lastname" size="1">
<option>00:00:00</option> <option>00:30:00</option>
<option>01:00</option> <option>01:30</option>
<option>02:00</option></select>
<br /><br />
<input type="submit" onclick="formSubmit()" value="Submit">
</form>
</body>
</html>
Above is my code. in the line
PHP Code:
<form name="myForm" action="message5.htm" method="post">
we know that if this form is validated by the function, it will be directed to
message5.htm . Unfortunately, no matter if it is true or false, it will still be directed to
message5.htm . Where is the error?
__________________
$id ="waxxer";
$id = str_replace('x', 'l', $id);
echo $id;
echo " and Marj";
|