trying out this new php form to help reduce the amount of spam, but I can’t get rid of the “Your submission has been sent sucessfully.” from the top of the form before the form was actually sent.
link to page:
http://andrewshemo.com/test/form/pazrt/contact.php
actual form code within the .php file:
<div id="contact">
<img src="images/leftlogo.png" alt="left logo" width="440px" style="float: left" />
<?php if($_POST['fred'] != "") {
echo('<p style="color: #8B2323; font-size: 16px; font-weight: bold;">You may be using a text-only browser or you are a spambot. Sorry this has not been submitted</p>');
}
else {
if(isset($_POST['name'])) {
if(($_POST['name'] == "") or ($_POST['email'] == "") or ($_POST['message'] == "")) {
echo('<p style="color: #8B2323; font-size: 16px; font-weight: bold;">Please fill in all fields</p>');
}
else {
$name = $_POST['name'];
$email = $_POST['email'];
$problem = $_POST['problem'];
$comments = $_POST['comments'];
$emailmessage = "You have received a submission from your contact form.
Name: $name
Email: $email
Problem: $problem
Comments: $comments
";
//Defining mail settings
$to = "Enter your email address here";
$subject = "Form submission sent";
$headers = "From: $email";
if(isset($name)) {
mail($to,$subject,$emailmessage,$headers);
}
}
}
}
?>
<?php if(isset($name)) {
echo('<p style="color: #8B2323; font-size: 15px; font-weight: bold;">Your submission has been sent successfully</p>');
} ?>
<form action="" method="post" id="contact">
<ul>
<li>Name:<?php echo $yourname; ?><br />
<input type="text" size="30" name="name" id="name" /></li>
<li><br /></li>
<li>Email:<?php echo $email; ?><br />
<input type="text" size="30" name="email" id="email" /></li>
<li><br /></li>
<li>Problem:<?php echo $problem; ?><br />
<select name="problem">
<option value="website problem">Website Problem</option>
<option value="forum problem">Forum Problem</option>
<option value="misc problem">Miscellaneous</option>
</select></li>
<li><br /></li>
<li>Comments:<?php echo $comments; ?><br />
<textarea name="comments" id="comments" rows="3" cols="45"></textarea></li>
<li><br /></li>
<li><br /></li>
<li><input type="text" id="fred" name="fred" style="visibility: hidden;"/></li>
<li><input type="submit" name="action" value="Submit" />
<input type="reset" name="reset" value="Reset" /></li>
</ul>
</form>
</div>
entire page code:
<?php
$name = htmlspecialchars($_POST['yourname']);
$email = htmlspecialchars($_POST['email']);
$problem = htmlspecialchars($_POST['problem']);
$comments = htmlspecialchars($_POST['comments']);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Contact the PAZRT- Pennsylvania Zombie Response Team</title>
<meta http-equiv="Content-Language" content="en-us" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="author" content="Pennsylvania Zombie Response Team" />
<meta name="copyright" content='All Copyright Pennsylvania Zombie Response Team, all rights reserved' />
<meta name="description" content="PAZRT- Pennsylvania Zombie Response Team is an elite group of people dedicated to the preservation of the human race in the face of a looming zombie outbreak" />
<meta name="keywords" content="pazrt, zrt, pennsylvania zombie response team, pennsylvania zrt, zombies, zombie response team, guns, knives, survival" />
<link href="layout.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="validation.js"></script>
</head>
<body>
<!-- This is the main div -->
<div id="wrapper">
<!-- Start logo coding -->
<div id="logo">
<img src="images/logo.png" alt="main logo" height="168px" style="width: 100%" />
</div>
<!-- Start navigation bar coding -->
<div id="navigation">
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="about-the-pennsylvania-zombie-response-team">About Us</a></li>
<li><a href="http://www.pazrt.com/forum">Forums</a></li>
<li><a href="http://www.pazrt.com/gallery">Gallery</a></li>
<li><a href="http://www.pazrt.com/forum/forum-zrt-wiki">Wiki</a></li>
<li><a href="#">Support<!--[if gte IE 7]><!--></a><!--<![endif]-->
<!--[if lte IE 6]><table><tr><td><![endif]-->
<ul>
<li><a href="donate-to-the-pennsylvania-zombie-response-team">Donate</a></li>
<li><a href="share-the-pennsylvania-zombie-response-team">Share</a></li>
<li><a href="http://www.cafepress.com/pazrt">Store</a></li>
</ul>
<!-- End Support drop-down menu -->
<!--[if lte IE 6]></td></tr></table></a><![endif]-->
</li><!-- End support -->
<li><a href="#">Social<!--[if gte IE 7]><!--></a><!--<![endif]-->
<!--[if lte IE 6]><table><tr><td><![endif]-->
<ul>
<li><a href="http://www.twitter.com/pazrt">Twitter</a></li>
<li><a href="http://www.facebook.com/pages/Pennsylvania-Zombie-Response-Team/10150095905020602">Facebook</a></li>
<li><a href="http://www.youtube.com/pazrt">Youtube</a></li>
</ul>
<!-- End Social drop-down menu -->
<!--[if lte IE 6]></td></tr></table></a><![endif]-->
</li><!-- End social -->
<li class="selected"><a href="contact-the-pennsylvania-zombie-response-team">Contact Us</a></li>
</ul>
</div>
<!-- Start contact content coding -->
<div id="contact">
<img src="images/leftlogo.png" alt="left logo" width="440px" style="float: left" />
<?php if($_POST['fred'] != "") {
echo('<p style="color: #8B2323; font-size: 16px; font-weight: bold;">You may be using a text-only browser or you are a spambot. Sorry this has not been submitted</p>');
}
else {
if(isset($_POST['name'])) {
if(($_POST['name'] == "") or ($_POST['email'] == "") or ($_POST['message'] == "")) {
echo('<p style="color: #8B2323; font-size: 16px; font-weight: bold;">Please fill in all fields</p>');
}
else {
$name = $_POST['name'];
$email = $_POST['email'];
$problem = $_POST['problem'];
$comments = $_POST['comments'];
$emailmessage = "You have received a submission from your contact form.
Name: $name
Email: $email
Problem: $problem
Comments: $comments
";
//Defining mail settings
$to = "Enter your email address here";
$subject = "Form submission sent";
$headers = "From: $email";
if(isset($name)) {
mail($to,$subject,$emailmessage,$headers);
}
}
}
}
?>
<?php if(isset($name)) {
echo('<p style="color: #8B2323; font-size: 15px; font-weight: bold;">Your submission has been sent successfully</p>');
} ?>
<form action="" method="post" id="contact">
<ul>
<li>Name:<?php echo $yourname; ?><br />
<input type="text" size="30" name="name" id="name" /></li>
<li><br /></li>
<li>Email:<?php echo $email; ?><br />
<input type="text" size="30" name="email" id="email" /></li>
<li><br /></li>
<li>Problem:<?php echo $problem; ?><br />
<select name="problem">
<option value="website problem">Website Problem</option>
<option value="forum problem">Forum Problem</option>
<option value="misc problem">Miscellaneous</option>
</select></li>
<li><br /></li>
<li>Comments:<?php echo $comments; ?><br />
<textarea name="comments" id="comments" rows="3" cols="45"></textarea></li>
<li><br /></li>
<li><br /></li>
<li><input type="text" id="fred" name="fred" style="visibility: hidden;"/></li>
<li><input type="submit" name="action" value="Submit" />
<input type="reset" name="reset" value="Reset" /></li>
</ul>
</form>
</div>
<!-- Start footer coding -->
<div id="footer">
<img src="images/footer.png" alt="footer logo" width="1000px" />
<p><a href="index.html">Home</a> | <a href="about-the-pennsylvania-zombie-response-team">About Us</a> | <a href="contact-the-pennsylvania-zombie-response-team">Contact Us</a><br /></p><p style="color: #FFF">Site by-<a href="http://www.webfinitydesign.com">Webfinity Design</a></p>
</div>
</div>
<script type="text/javascript">var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));</script>
<script type="text/javascript">try { var pageTracker = _gat._getTracker("UA-10934935-1"); pageTracker._trackPageview(); } catch(err) {}</script>
</body>
</html>