Ok, will try one simple form, maybe that will clear things out.
As I understand- you’re saying that PHP should check form fields not only if they are blank, but also check a format entered (for example email field should be ‘myemail@domain.com’)? Does PHP use RegEx?
Hi
I managed to validate my form with jQuery, form sends email, but when clicked on ‘Send’- it opens another page, where my mail() is. I would like it not to be directed to .php file, how can I do that?
<?php
$wily_coyote_messages = array(
0=>"Funny? That should not happen ...",
1=>"Welcome, now please proceed under this huge rock.",
...
23="Your email is sent! Thanks for your interest in Acme Rocket Skates",
);
if( isset($_GET['msg'])){
echo "<p>" . $wily_coyote_messages [(int)$_GET['msg']] . "</p>";
}
This is how my code looks like in send.php page, but it doesn’t work. Any ideas why?
<?php
//start building the mail string
$msg .= "Name: “.$_POST[“name”].”
";
$msg .= "E-Mail: “.$_POST[“emailaddress”].”
";
$msg .= "Tel No: “.$_POST[“telNr”].”
";
$msg .= "Message: “.$_POST[“limitedtextarea”].”
";
//set up the mail
$recipient = “email@email.co.uk”;
$subject = “Subject”;
$mailheaders = "Mailheaders<email@email.com>
";
$mailheaders .= "Reply-To: ".$_POST[“email”];
//send the mail
mail($recipient, $subject, $msg, $mailheaders);
By ‘it doesn’t work’ I meant that id does not redirect to another page once the form is submitted.
I realised, that it might be a wrong code. My form is on .html page, I want it to be send in the background (if it validates) and then thankyou.html to be displayed.
I’d feel a whole lot better if you said you understand the principle of the idea I just placed before you - or asked me questions if you did not understand what the heck bool or boolean meant.