I am new to php and the code is basically jibberish to me (I don’t like variables), but I have a contact form I am creating for a website. I did use some canned php code and created my own html contact form. However, when I click submit on the contact form it does nothing. The php code does not popup, nor does the error or thank you page. I have no idea what the problem is I have tried it on my local MAMP server, my web server (1and1) and even on free hosting site just to see if the problem could be php configuration. Same result every time. Here is both the php and the html code (minus a lot of the stylistic stuff if anyone thanks its necessary then I can post that too) for the contact page because I don’t know where the problem could be. I even plugged it into a php code checker and got no errors.
[php]<?php
$webmaster_email = "[email protected]";
$feedback_page = “contact_form.html”;
$error_page = “error_message.html”;
$thankyou_page = “thank_you.html”;
$Full_Name = $_REQUEST[‘Full_Name’] ;
$City = $_REQUEST[‘City’] ;
$State = $_REQUEST[‘State’] ;
$Email_Address = $_REQUEST[‘Email_Address’] ;
$Comments = $_REQUEST[‘Comments’] ;
/*
The following function checks for email injection.
Specifically, it checks for carriage returns - typically used by spammers to inject a CC list.
*/
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 the user tries to access this script directly, redirect them to the feedback form,
if (!isset($_REQUEST[‘email_address’])) {
header( “Location: $feedback_page” );
}
// If email injection is detected, redirect to the error page.
elseif ( isInjected($email_address) ) {
header( “Location: $error_page” );
}
// If we passed all previous tests, send the email then redirect to the thank you page.
else {
mail( “$webmaster_email”, “Feedback Form Results”,
$comments, “From: $email_address” );
header( “Location: $thankyou_page” );
}
?>[/php]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<div class="content">
<p> </p>
<h1 align=center class="content">Contact TxOHC</h1>
<div class="hi">Thank you for your interest</div>
</p>
<p class="content"> </p>
<form method="post" action="send_mail.php" >
<label>Full Name
<input name="Full_Name" type="text" class="required" id="Full_Name"size="50" maxlength="200" />
</label>
<p></p>
<p>
<label>City
<input type="text" name="City" id="City">
</label>
<label>State
<input name="State" type="text" id="State" size="10">
</label>
<label><br />
<br />
Email Address
<input name="Email_Address" type="text" class="required" id="Email_Address" size="30" maxlength="200">
</label>
</p>
</p>
<p> </p>
<p>Questions and Comments</p>
<p>
<textarea name="Comments" cols="50" rows="15
"></textarea>
</p>
<p> </p>
<p align=center> <input type="submit" value="Submit" /></p>
<p>
</p>
</form>
</div>
<!-- end .container --></div>
</body>
</html>