<pre><?php $mail_to = 'myemail@gmail.com'; // specify your email here // Assigning data from the $_POST array to variables $name = $_POST['w3lName']; $mail_from = $_POST['w3lSender']; $phone = $_POST['w3lPhone']; $msubject = $_POST['w3lSubject']; $message = $_POST['w3lMessage']; // Construct email subject $subject = 'Message from visitor ' . $name; // Construct email body $body_message = 'From: ' . $name . "\r\n"; $body_message .= 'E-mail: ' . $mail_from . "\r\n"; $body_message .= 'Phone: ' . $phone . "\r\n"; $body_message .= 'Subject: ' . $msubject . "\r\n"; $body_message .= 'Message: ' . $message; // Construct email headers $headers = 'From: ' . $mail_from . "\r\n"; $headers .= 'Reply-To: ' . $mail_from . "\r\n"; // Send mail $mail_sent = mail($mail_to, $subject, $body_message, $headers); // redirect to success page if ($success){ header("Location:https://www.bbc.com"); //Redirect to url if form submitted } else{ echo "Error"; } ?>
$mail_sent = mail($mail_to, $subject, $body_message, $headers); // redirect to success page if ($success){ // you should be checking $mail_sent header("Location:https://www.bbc.com"); //Redirect to url if form submitted } else{ echo "Error"; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)