SashenG
Member
- Joined
- Feb 16, 2017
- Messages
- 28
- Reaction score
- 1
Hi All,
Having an issue where my PHP redirects to the actual form when i click on submit, (just a white page with errors), but i did get the email like 6 hours later, Can anyone assist ?
<?php
// Variables
$name = trim($_POST['name']);
$email = trim($_POST['email']);
$phone = trim($_POST['phone']);
$subject = "A Query from Basikwa Website";
$message = trim($_POST['message']);
function is_email_valid($email) {
return filter_var($email, FILTER_VALIDATE_EMAIL);
}
if( isset($name) && isset($email) && isset($phone) && isset($message) && is_email_valid($email) ) {
$pattern = "/(content-type|bcc:|cc:|to
/i";
if( preg_match($pattern, $name) || preg_match($pattern, $email) || preg_match($pattern, $message) ) {
exit;
}
// Email Sent To
$to = "[email protected]";
$sub = $subject; // You can define email subject
// HTML Elements for Email Body
$body = <<<EOD
<strong>Name:</strong> $name <br>
<strong>Email:</strong> <a href="mailto:$email?subject=feedback" "email me">$email</a> <br> <br>
<strong>Message:</strong> $message <br>
EOD;
/
$headers = "From: $name <$email>\r\n";
$headers .= 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$header('Location: http://www.basikwa.com/contact.html');
header("Location:http://www.basikwa.com/contact.html");
// PHP email sender
mail($to, $sub, $body, $headers);
echo "Your Email Was Sent Successfully"
}
?>
Having an issue where my PHP redirects to the actual form when i click on submit, (just a white page with errors), but i did get the email like 6 hours later, Can anyone assist ?
<?php
// Variables
$name = trim($_POST['name']);
$email = trim($_POST['email']);
$phone = trim($_POST['phone']);
$subject = "A Query from Basikwa Website";
$message = trim($_POST['message']);
function is_email_valid($email) {
return filter_var($email, FILTER_VALIDATE_EMAIL);
}
if( isset($name) && isset($email) && isset($phone) && isset($message) && is_email_valid($email) ) {
$pattern = "/(content-type|bcc:|cc:|to
if( preg_match($pattern, $name) || preg_match($pattern, $email) || preg_match($pattern, $message) ) {
exit;
}
// Email Sent To
$to = "[email protected]";
$sub = $subject; // You can define email subject
// HTML Elements for Email Body
$body = <<<EOD
<strong>Name:</strong> $name <br>
<strong>Email:</strong> <a href="mailto:$email?subject=feedback" "email me">$email</a> <br> <br>
<strong>Message:</strong> $message <br>
EOD;
/
$headers = "From: $name <$email>\r\n";
$headers .= 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$header('Location: http://www.basikwa.com/contact.html');
header("Location:http://www.basikwa.com/contact.html");
// PHP email sender
mail($to, $sub, $body, $headers);
echo "Your Email Was Sent Successfully"
}
?>
Last edited: