Contact Form

I created a form on a website that will email me the results. I started by creating the file contact.php, then I created sendmail.php. At first I had the form at http://www.xxxxxxxx.com/contact.php, and everything worked fine. After several test I copied the form onto my html contact page and I never recieved any results, but everything seemed to work fine. Anyone have any ideas? I’m a fairly new at php so please don’t bash!

contact.php code
[php]

<?php $ipi = getenv("REMOTE_ADDR"); $httprefi = getenv ("HTTP_REFERER"); $httpagenti = getenv ("HTTP_USER_AGENT"); ?>

Your Name:




Phone:




Your Email:






Policy:

Commercial Personal

Brief Description:

sendmail.php code

<?php $email = $_REQUEST['email'] ; $message = $_REQUEST['message'] ; if (!isset($_REQUEST['email'])) { header( "Location: http://www.XXXXXXXXXX.com/thankyou.html" ); } elseif (empty($email) || empty($message)) { ?>
<html>
<head><title>Error</title></head>
<body>
<h1>Error</h1>
<p>
 It appears you forgot to enter something in one of the fields.  Please press the back button on your browser and try again.
</p>
</body>
</html>

<?php

}
else {
mail( "[email protected]", “Feedback Form Results”,
$message, “From: $email” );
header( “Location: http://www.XXXXXXXXXXXX.com/thankyou.html” );
}
?>[/php]

**Mod Edit - Added php bb tags for readability.

Just some tips:

Shouldn’t use $_REQUEST.

$_POST[’’] for farming information from forms.
$_GET[’’] for farming information from the url.

Are you getting any errors? Not sure I understand exactly what is going on.

No errors, when I finished filling out the form it directs me to my thankyou page like it should. Last night I got 2 emails with the form results then nothing after.

Its like it just died on me for no reason.

Sponsor our Newsletter | Privacy Policy | Terms of Service