Monday, March 22, 2010

Creating simple PHP contact form

When you need user send feedback to your email you can usecontact form. In this tutorial you'll learn how to create contact form with php script.
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
############### Code
// Contact subject
$subject ="$subject";
// Details
$message="$detail";
// Mail of sender
$mail_from="$customer_mail";
// From
$header="from: $name <$mail_from>";
// 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";
}
?>

No comments:

Post a Comment

MyUrduStuff

Search This Blog

My Urdu Stuff