Simple Contact form

<form  method=”post” action=”contact.php “>

<p><label for=”name”>Name:</label>

<input name=”name” id=”name” type=”text” /></p>

<p><label for=”email”>Email:</label>

<input name=”email” id=”email” type=”text” /></p>

<p><label for=”comments”>Comments:</label>

<textarea name=”comments” id=”comments” cols=”60″ rows=”8″></textarea> </p>

<p> <input name=”send” id=”send” type=”submit” value=”Send message” /></p>



// process the email
if (array_key_exists(‘send’, $_POST))

{  $to = ‘’; // use your own email address

$subject = ‘Feedback from Recipes site’;

// process the $_POST variables

$name = $_POST[‘name’];

$email = $_POST[’email’];

$comments = $_POST[‘comments’];

// build the message

$message = “Name: $name\n\n”;

$message .= “Email: $email\n\n”;

$message .= “Comments: $comments”;
// limit line length to 70 characters

$message = wordwrap($message, 70);

// send it

$mailSent = mail($to, $subject, $message);  }



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s