if ($verzendbutton != "send" || valid_name($name)) {
echo "<form action=\"$PHP_SELF\" method=\"post\">";
?>
<input name="name" type="text" value="<?php echo $name ?>" size="15" maxlength="30"><?php
if ($verzendbutton && !valid_name($name)) {
echo "<font color=\"red\"size=\"1\"><br/>Vul hier uw achternaam correct in!</font>";
}
?>
<input type="submit" value="send" name="verzendbutton">
<input type="reset" value="wissen" name="wissen">
</table>
</form>
<?php
} else {
$mailadres = "you@hotmail.com";
$to = "me@hotmail.com";
$message ="\nname: ".$name;
mail($to, "order:", $message, "From: $mailadres");
echo "<br/>Thanks".$name."<br/>You will here from us soon"; }
well... that was my code... so far so go.. it works...
now, my question is: just One easy javascript alert().
When someone has forgotten to fill in my form RIGHT, it will not be send indeed, but a javascript alert will make the difference...
then they certainly gonna look were they didn't fill the form correctly.
(After spending my whole Easter on it I give up; especially because I thought it would be easy.)
I made this:
function js_alert($bericht)
{ if ($verzendbutton != "send")
return;
echo (
"\n<SCRIPT LANGUAGE='JavaScript'>\n" .
" <!-- \n" .
" alert (\"$bericht\");\n" .
" // --> \n" .
"</SCRIPT>\n"
);
}
// call function
js_alert("You filled in wrong!");
i combined it but now I allready got an alert when they get on my form.php
I only want an window.alert when they filled my form incorrect or not at all...
Who can help me?
Thanks.