php help please

Okay so I have two forms they are identical. They are both hosted on yahoo small business website hosting package with two different domains and the php code is identical on both.

Basically its a reservation form that calls to the php file and then once the captcha test is passed the email is sent.

It works on one and not the other. I found a very simple php forum code to verify that the issue does not with the hosting company but in fact within the code. Can someone please tell me what i am doing wrong or what I can do to fix this issue.

This is the code I found to test and make sure my hosting company is in fact allowing the message to be sent
[php]<?php
/*
From http://www.html-form-guide.com
This is the simplest emailer one can have in PHP.
If this does not work, then the PHP email configuration is bad!
/
$msg="";
if(isset($_POST[‘submit’]))
{
/
Important!
replace [email protected] below
with an email address that belongs to
the website where the script is uploaded.
For example, if you are uploading this script to
www.my-web-site.com, then an email like
[email protected] is good.
*/

$from_add = "[email protected]"; 

$to_add = "[email protected]"; //<-- put your yahoo/gmail email address here

$subject = "Test Subject";
$message = "Test Message";

$headers = "From: $from_add \r\n";
$headers .= "Reply-To: $from_add \r\n";
$headers .= "Return-Path: $from_add\r\n";
$headers .= "X-Mailer: PHP \r\n";


if(mail($to_add,$subject,$message,$headers)) 
{
	$msg = "Mail sent OK";
} 
else 
{
   $msg = "Error sending email!";
}

}
?>

Test form to email <?php echo $msg ?>

' method='post'>

[/php] This works. This is where to form tells it what to do on submit

This is the code from captcha.php file
[php]<?php

session_start();

?>

<? if ($_SERVER["REQUEST_METHOD"] <> "POST") die("You can only reach this page by posting from the html form"); // *** The text input will come in through the variable $_POST["captcha_input"], // while the correct answer is stored in the cookie $_COOKIE["pass"] *** if ($_POST["security"] == $_SESSION["pass"]) { // *** They passed the test! *** // *** This is where you would post a comment to your database, etc *** echo "Correct! You have passed the captcha test.

"; echo "You information input has been sent

"; echo "This is what you sent

"; echo "Name: \"" . $_POST["name"] . "\"
"; echo "Address: \"" . $_POST["address"] . "\"
"; echo "Address2: \"" . $_POST["address2"] . "\"
"; echo "City: \"" . $_POST["city"] . "\"
"; echo "State: \"" . $_POST["state"] . "\"
"; echo "Zipcode: \"" . $_POST["zipcode"] . "\"
"; echo "Phone: \"" . $_POST["phone"] . "\"
"; echo "Email: \"" . $_POST["email"] . "\"
"; echo "Passenger_Number: \"" . $_POST["passnumber"] . "\"
"; echo "Cabin_type: \"" . $_POST["cabin_type"] . "\"
"; echo "Cruise_1: \"" . $_POST["cruise_1"] . "\"
"; echo "Cruise_2: \"" . $_POST["cruise_2"] . "\"
"; echo "comments: \"" . $_POST["comments"] . "\"
"; //sends email via php to the following address $mailuser = "[email protected]"; //echo 'default chosen address: '.$mailuser; $header = "Return-Path: ".$mailuser."\r\n"; $header .= "Content-Type: text/html\r\n" ; $header .= "From: San Juan Reservations <".$mailuser.">\r\n"; $message .= ''; $message .= ''; $message .= ""; $message .= ""; $message .= ""; $message .= ""; $message .= ""; $message .= ""; $message .= ""; $message .= ""; $message .= ""; $message .= ""; $message .= ""; $message .= ""; $message .= ""; $message .= "
Name: " . strip_tags($_POST['name']) . "
Address: " . strip_tags($_POST['address']) . "
Address2: " . strip_tags($_POST['address2']) . "
City: " . strip_tags($_POST['city']) . "
State: " . strip_tags($_POST['state']) . "
Zipcode: " . strip_tags($_POST['zipcode']) . "
Phone Number: " . strip_tags($_POST['phone']) . "
Email: " . strip_tags($_POST['email']) . "
Number of Passengers: " . strip_tags($_POST['passnumber']) . "
Cabin Type: " . strip_tags($_POST['cabin_type']) . "
Cruise Option 1: " . strip_tags($_POST['cruise_1']) . "
Cruise Option 2: " . strip_tags($_POST['cruise_2']) . "
Customer Comments: " . strip_tags($_POST['comments']) . "
"; $message .= ""; mail ($mailuser, 'San Juan Reservation Form', $message, $header); echo 'Thank You for contacting us. We will be getting back with you shortly. '; } else { // *** The input text did not match the stored text, so they failed *** // *** You would probably not want to include the correct answer, but // unless someone is trying on purpose to circumvent you specifically, // its not a big deal. If someone is trying to circumvent you, then // you should probably use a more secure way besides storing the // info in a cookie that always has the same name! :) *** echo "Sorry, you did not pass the CAPTCHA test.

"; echo "You said " . $_POST["captcha_input"]; echo " while the correct answer was " . $_SESSION["pass"]; echo " - Please click back in your browser and try again

"; } ?>[/php]

can someone please help me I am at my wits end. Thank you.

My guess is here,

if ($_SERVER[“REQUEST_METHOD”] <> “POST”)

<> is not != in php

I agree with Astonecipher!

Also, you should not post email addresses or passwords on this site. Unless you wish to receive a lot of
spam emails as spammers view most blogs for email addresses… Just a thought…

Sponsor our Newsletter | Privacy Policy | Terms of Service