CMS records conflict with php contact form
2 posts by 2 authors in: Forums > CMS Builder
Last Post: November 13, 2013 (RSS)
By meg - November 12, 2013
The php contact form I use conflicts with the CMS records after the contact delivery session has run, thanking the user for the inquiry.
Here's the error I receive:
Notice: Undefined variable: body in /data/17/1/113/93/1602093/user/1726350/htdocs/contact-hudson-valley-wedding-florist.php on line 96 Notice: Undefined variable: _SESSION in /data/17/1/113/93/1602093/user/1726350/htdocs/contact-hudson-valley-wedding-florist.php on line 105 Notice: Undefined index: security_code in /data/17/1/113/93/1602093/user/1726350/htdocs/contact-hudson-valley-wedding-florist.php on line 105
Here's the php code I use for the contact form. Any suggestions on resolving this?
<?php if(isset($_POST['send'])){
$emailFrom = "Website Inquiry";
$emailTo = "email address goes here";
$subject = "General Inquiry";
$name = strip_tags($_POST['name']);
$phone = strip_tags($_POST['phone']);
$email = strip_tags($_POST['email']);
$message = strip_tags(stripslashes($_POST['message']));
$body .= "Name: ".$name."\n";
$body .= "Phone: ".$phone."\n";
$body .= "Email: ".$email."\n";
$body .= "Message: ".$message."\n";
$headers = "From: ".$emailFrom."\n";
$headers .= "Reply-To:".$email."\n";
if($_SESSION['security_code'] == $_POST['security_code']){
$success = mail($emailTo, $subject, $body, $headers);
if ($success){
echo '<p class="contact-message-done">Thank you for your inquiry. We will contact you shortly.</p>';
}
} else {
echo '<p class="contact-message-done">Your submission was invalid. Please make sure you filled in all the appropriate fields and please submit again.</p>';
}
} else {
?>
By Damon - November 13, 2013
Hi Meg,
Can you reply with the URL for the contact page and the complete code for the page?
If you don't want to post these details in the forum, send them in to support@interactivetools.com.
Also include a link to this post for reference:
http://www.interactivetools.com/forum/forum-posts.php?CMS-records-conflict-with-php-contact-form-79126
Thanks!
Damon Edis - interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/