View Full Version : Form does not send

03-10-2009, 07:34 AM
I cant seem to figure out why this code isnt working. All the error messages pop up for name of theres not name and email for no email and same for message. but when u fill out the form and hit send. The form resets and the Message Error shows up "Let me hear your thoughts"

Any help with this would be appreciated.

if (isset($_POST['submit'])) {
$name = $_POST['Name'];
$email = $_POST['Email'];
$message = $_POST['message'];

if (empty($name))
$err1 = 1;
elseif (empty($email))
$err2 = 1;
elseif (empty($message))
$err3 = 1;
else {
if (!preg_match('/^([a-z0-9])([\w\.\-\+])+([a-z0-9])\@(([\w\-]?)+\.)+([a-z]{2,4})$/i',$email))
$err4 = 1;
else {
$EmailFrom = "eric@dragonethosting.com";
$EmailTo = "eric@habugfx.com";
$Subject = "Habu GFX Contact Form";

// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "Email: ";
$Body .= $Email;
$Body .= "\n";
$Body .= "Message: ";
$Body .= $Message;
$Body .= "\n";

// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">


<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>Venom PC Website</title>

<meta http-equiv="keywords" content="pc,venom pc,computers,custom,built,justin" />

<link href="include/style.css" media="all" rel="stylesheet" />
<script type="text/javascript" src="include/scripts/validate.js">
Script Title: Form Validation for Habu GFX
Script Author: Raymond Angana
Date Created: 2/22/2009
This notice must stay intact for legal use

<!--start top banner-->
<div id="header">
<div id="header_inner">
<div id="header_logo"></div>
<!--end top banner-->

<!--start navigation-->
<div id="navwrapper">
<div id="navcontainer">
<ul id="navlist">
<?php include('include/nav.php'); ?>
<!--end navigation-->

<!--begin wrapper - note that it ends right bofore the closing body tag-->
<div id="main_wrapper">

<!--begin left-column content-->

<div id="left_column">

<div id="left_column_inner">

<h1>Contact Me:</h1>
<p>Justin Kruse</p>
<p>200 W. North Street</p>
<p>Elida, Ohio 45807</p>
<p>Home: 419-339-9229</p>
<p>Cell: 419-979-9213</p>
if ($success)
echo '
<div style="color:#930;padding:10px;">
<strong>Thank you for contacting me, I will return your e-mail as soon as possible.</strong>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" id="myform">
<div class="label">Name:</div>
<div class="cform">
<input type="text" name="Name" id="fname">
if ($err1)
echo '<strong style="color:#930;" id="fname_err"> Please let me know who you are</strong>';
<div class="label">Email:</div>
<div class="cform">
<input type="text" name="Email" id="email">
if ($err2)
echo '<strong style="color:#930;" id="email_err"> I need your email address too</strong>';
if ($err4)
echo '<strong style="color:#930;" id="email_err"> Your email address is invalid</strong>';

<div class="label">Message:
if ($err3)
echo '<strong style="color:#930;" id="message_err"> Please let me hear your thoughts</strong>';
<div class="cform"><br>
<textarea name="Message" id="message" rows="6" cols="50"></textarea>
<div class="submit">

<input type="submit" name="submit" value="Submit" class="submit-button">

<!--end left-column content-->

<!--begin right column-->
<div id="right_column">

<div id="right_column_inner">Sample NewsSample NewsSample NewsSample NewsSample NewsSample NewsSample NewsSample News </div>
<div id="right_column_inner2">
<p class="subheading">Heading</p>

<p> Sample TextSample TextSample TextSample TextSample TextSample TextSample TextSample TextSample TextSample TextSample Text </p>

<!--end right column-->

<!--begin footer-->

<div id="footer">

<div id="footer_inner"><?php include('include/footer.php')?></div>

<!--end footer-->

<!--end main wrapper-->



03-10-2009, 09:30 AM
I figured it out
$message = $_POST['message']; needed to be
$message = $_POST['Message'];