Creating simple PHP contact form by yourself in php

May 2, 2010 by  
Filed under PHP Scripts

Overview

if you want to test on you own computer you must set your computer as a mail server by using Argosoft mail server or relate software.
read this tutorial

In this tutorial create 2 files
1. contact.php
2. send_contact.php

Step
1. Create file contact.php.
2. Create file send_contact.php.

Create file contact.php

############### Code

Contact Form
Subject :
Detail :
Name :
Email :
   

Create file send_contact.php

Diagram

############### Code

<?php
// Contact subject
$subject ="$subject";
// Details
$message="$detail";

// Mail of sender
$mail_from="$customer_mail";
// From
$header="from: $name “;

// Enter your email address
$to =’someone@somewhere.com’;

$send_contact=mail($to,$subject,$message,$header);

// Check, if message sent to your email
// display message “We’ve recived your information”
if($send_contact){
echo “We’ve recived your contact information”;
}
else {
echo “ERROR”;
}
?>

Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!

*