PHP Contact form help

The code below sits on a page named contact.php Essentially this contains standard contact details, AS WELL as being the form processor for a Contact form which sits on each page across the website, and the action on this form is action=“contact.php?send=yes” which I hoped would then process the below. So then the page CAN be a normal content page, although at other times, when actioned contact.php?send=yes, it would then execute the code below, however this doesn’t seem to work? And the server offers no error message to help me resolve this. Any help would be much appreciated - I am just learning PHP!! Thank you.

<? &sendemail = $_GET["send"]; if (&sendemail == "yes") { $to = "[email protected], [email protected]"; $from = "[email protected]"; $subject = "Contact Form"; while( list($var,$val) = each($HTTP_POST_VARS) ) { $email .= "$var: $valn"; } mail($to,$subject,$email,"From: $from"); echo "

Your contact form message has been successfully sent!

"; } ?>

if (isset($_GET[‘send’]) && $_GET[‘send’] == ‘yes’)
{
//… do something
}

Also, always use full php tags, like <?php and ?> instead of <? and ?>

Use the following at the top of all your PHP scripts:

[php]error_reporting(E_ALL);[/php]

It’ll most likely return an error for you and allow you to debug (see my signature).

Sponsor our Newsletter | Privacy Policy | Terms of Service