This blog is about Graphic Design, Vector Art, and Cartoon Illustration BradHallArt.com


Creating a contact form with php - modifying the script


After you've created the form, it gets kind of nerdy. You will need to modify the php code


if(isset($_POST['submit'])) {
$to = "youremail@yoursite.com";
$subject = "Message to you";
$name_field = $_POST['name'];
$email_field = $_POST['email'];
$phone_field = $_POST['phone'];
$message = $_POST['message'];
$headers = 'From: '.$name_field.' <'.$email_field.'>' . "\r\n";

$body = "Name: $name_field\n Email: $email_field\n Phone number: $phone_field\n Message:\n $message";

mail($to, $subject, $body, $headers);

//redirects user to success page
header("location: http://www.yoursite.com/thankyou.html");

}
?>
You must change the email address to yours, and the URL of the thank you page (also created in HTML in Dreamweaver).