namanhle91 Posted March 29, 2012 Share Posted March 29, 2012 Hi All, I am trying to get this contact form to work correctly. The problem I have right now is that the e-mail sends only the Name, Email Address, and Phone Number, and it will not send anything for the body or "message" portion. The first code is contact.php <?php /* Credits: Bit Repository URL: http://www.bitrepository.com/ */ include 'contact_config.php'; session_start(); error_reporting (E_ALL ^ E_NOTICE); $post = (!empty($_POST)) ? true : false; if($post) { include 'functions.php'; $name = stripslashes($_POST['name']); $email = trim($_POST['email']); $phone = stripslashes($_POST['phone']); $subject = stripslashes($_POST['subject']); $message = "Site visitor information: Name: ".$_POST['name'] ." E-mail Address: ".$_POST['email'] ." Phone: ".$_POST['phone'] ." Message: ".$_POST['message']; $error = ''; // Check name if(!$name) { $error .= 'Please enter your First name.<br />'; } // Check email if(!$email) { $error .= 'Please enter an e-mail address.<br />'; } if($email && !ValidateEmail($email)) { $error .= 'Please enter a valid e-mail address.<br />'; } if(isset($_SESSION['captcha_keystring']) && strtolower($_SESSION['captcha_keystring']) != strtolower($_POST['capthca'])) { $error .= "Incorect captcha.<br />"; } if(!$error) { $mail = mail(WEBMASTER_EMAIL, $subject, $message, "From: ".$name." <".$email.">\r\n" ."Reply-To: ".$email."\r\n" ."X-Mailer: PHP/" . phpversion()); if($mail) { echo 'OK'; } } else { echo '<div class="notification_error">'.$error.'</div>'; } } ?> and contact_config.php only contain the webmaster's email address. Thank you for your help. Quote Link to comment Share on other sites More sharing options...
smerny Posted March 29, 2012 Share Posted March 29, 2012 are you basically saying that $_POST['message'] is coming in empty? so for example, you see: Site visitor information: Name: Bob E-mail Address: Bob@somesite.com Phone: 555-555-5555 Message: ? also... i notice you're doing some trimming and slash stripping, creating new variables... but then you continue using the POST variables.. Quote Link to comment Share on other sites More sharing options...
namanhle91 Posted March 29, 2012 Author Share Posted March 29, 2012 are you basically saying that $_POST['message'] is coming in empty? so for example, you see: Site visitor information: Name: Bob E-mail Address: Bob@somesite.com Phone: 555-555-5555 Message: ? also... i notice you're doing some trimming and slash stripping, creating new variables... but then you continue using the POST variables.. Yes that is exactly what is happening! Is the conflict you listed above causing the problem? Thank you Quote Link to comment Share on other sites More sharing options...
smerny Posted March 29, 2012 Share Posted March 29, 2012 no, show the form.. seems like $_POST['message'] isnt getting sent.. check that there is an input with a name='message' within your form being submitted Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.