I need help trying to figure out why my form will not send out and email. If anyone could look over my php file and the code in my main html file, i would be eternally grateful!
PHP Code
<?php
$webmaster_email = "jq92buu@gmail.com";
$feedback_page = "Booking.html";
$error_page = "error_message.html";
$thankyou_page = "thank_you.html";
$name = $_REQUEST['name'] ;
$email_address = $_REQUEST['email_address'] ;
$website = $_REQUEST['website'] ;
$comments = $_REQUEST['comments'] ;
function isInjected($str) {
$injections = array('(\n+)',
'(\r+)',
'(\t+)',
'(%0A+)',
'(%0D+)',
'(%08+)',
'(%09+)'
);
$inject = join('|', $injections);
$inject = "/$inject/i";
if(preg_match($inject,$str)) {
return true;
}
else {
return false;
}
}
if (!isset($_REQUEST['email_address'])) {
header( "Location: $feedback_page" );
}
elseif (empty($email_address) || empty($comments)) {
header( "Location: $error_page" );
}
elseif ( isInjected($email_address) ) {
header( "Location: $error_page" );
}
else {
mail( "$webmaster_email", "Feedback Form Results",
$name,
$email_address,
$website,
$comments,"From: $email_address" );
header( "Location: $thankyou_page" );
}
?>
Main HTML Code
<h2 class="cufon">Form</h2>
<form action="send_mail.php" method="post" class="form">
<ul>
<li>
<label for="input-01">Your Name (required):</label>
<input type="text" size="45" class="input-text" id="input-01" name="name" />
</li>
<li>
<label for="input-02">E-mail Address (required):</label>
<input type="text" size="45" class="input-text" id="input-02" name="email_address" />
</li>
<li>
<label for="input-03">Website:</label>
<input type="text" size="45" class="input-text" id="input-03" name="website" />
</li>
<li>
<label for="input-04">Your Message, Venue Name, and any other details (required):</label>
<textarea cols="75" rows="10" class="input-text" id="input-04" name="comments"></textarea>
</li>
<li><input type="submit" value="Submit" class="input-submit" /></li>
</ul>
</form>
Thank you for your time and concern 🙂