Contact Form Issue

Hi,

I’m trying to help a friend of mine figure out why her “Contact Us” form is not working on her website. I’m posting the code below, please tell me if there is something wrong with it. I am not familiar with php and cannot figure it out. The form returns a message that submission was successful however she does not receive any thing in her email.

<?php $contact_name = $_POST['name']; $contact_email = $_POST['email']; $contact_subject = $_POST['subject']; $contact_message = $_POST['message']; if( $contact_name == true ) { $sender = $contact_email; $receiver = "[email protected]"; $client_ip = $_SERVER['REMOTE_ADDR']; $email_body = "Name: $contact_name \nEmail: $sender \n\nSubject: $contact_subject \n\nMessage: \n\n$contact_message \n\nIP: $client_ip \n\nFrom Adam's Interpreting Contact Form"; $extra = "From: $sender\r\n" . "Reply-To: $sender \r\n" . "X-Mailer: PHP/" . phpversion(); if( mail( $receiver, "Contact Form - $contact_subject", $email_body, $extra ) ) { echo "success=yes"; } else { echo "success=no"; } } ?>

Hi there,

I think:
[php]
if($contact_name == true)
[/php]

needs to become:
[php]
if(isset($contact_name) && trim($contact_name) != “”)
[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service