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

March 3, 2010

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 = "";
$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

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

No comments:

Post a Comment