I've been trying to create a small web design service, and am working on making a request form that emails me all of their information when they submit the form. However, the email never sends. Is there anything wrong with my code?
PHP Code:
And the HTML form:
Thanks for any help.
PHP Code:
Code:
<?php
// Pick up the form data and assign it to variables
$first_name = $_REQUEST['first_name'] ;
$last_name = $_REQUEST['last_name'] ;
$email = $_REQUEST['email'] ;
$aim = $_REQUEST['aim'] ;
$yim = $_REQUEST['yim'] ;
$type = $_REQUEST['type'] ;
$site_name = $_REQUEST['site_name'] ;
$comments = $_REQUEST['comments'] ;
// Build the email (replace the address in the $to section with your own)
$to = 'bjett92@comcast.com';
$subject = "New Request";
$message = "$first_name $last_name ($email, AIM: $aim, YIM: $yim) needs a $type site named $site_name. Additional comments are: $comments";
$headers = "From: $email";
// Send the mail using PHPs mail() function
mail($to, $subject, $message, $headers);
// Redirect
header("Location: thankyou.php");
?>
And the HTML form:
Code:
<form id="request" action="mail.php" method="post">
First Name: <input type="text" name="first_name" /><br />
Last Name: <input type="text" name="last_name" /><br />
E-mail: <input type="text" name="email" /><br />
AIM Screen Name: <input type="text" name="aim" /><br />
YIM Screen Name: <input type="text" name="yim" /><br />
Type of Site: <select name="type"><option value="Business">Business</option><option value="Personal">Personal</option><option value="other">Other</option></select><br />
Name of Site: <input type="text" name="site_name"><br />
Additional Comments:<br /><textarea name="comments"></textarea><br />
<input type="submit" value="Send Request" /><input type="reset" value="Clear" />
</form>
Thanks for any help.