Currently, I am working on a formula. I created the check function and they are all working. If the check function returns false nothing gets saved, but it still redirects to the congrats page?
here the code:
function check() {
var msg = "";
if ($_POST['Bustransfer'] == "ja" ) {
msg = "wrong\n";
document.formular.v6.style.backgroundColor = "#FF0000";
}
if (msg == "") return(true);
else {
alert(msg);
return(false);
}
}
and then I got the following in the body section:
<form method="post" action="Email.php" name="formular" onsubmit="return check()">
I don't get it, hope you can help me. Cheers!
You are mixing them(
javascript
&php
) up. Should be'<?php echo $_POST['Bustransfer']; ?>'
instead of$_POST['Bustransfer']
in the check.