PHP Project-1: Creating simple PHP contact form

Posted: November 4, 2010 in HTML, PHP
Tags: ,

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

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


1. Create file contact.php

View In Browser

Code of HTML

<table width="400" border="0" align="center" cellpadding="3" cellspacing="1">
<td><strong>Contact Form </strong></td>

<table width="400" border="0" align="center" cellpadding="0" cellspacing="1">
<td><form name="form1" method="post" action="send_contact.php">
<table width="100%" border="0" cellspacing="1" cellpadding="3">
<td width="16%">Subject</td>
<td width="2%">:</td>
<td width="82%"><input name="subject" type="text" id="subject" size="50"></td>
<td><textarea name="detail" cols="50" rows="4" id="detail"></textarea></td>
<td><input name="name" type="text" id="name" size="50"></td>
<td><input name="customer_mail" type="text" id="customer_mail" size="50"></td>
<td><input type="submit" name="Submit" value="Submit">  <input type="reset" name="Submit2" value="Reset"></td>


2.Create file send_contact.php


Code of  PHP

// Contact subject
$subject ="$subject";
// Details

// Mail of sender
// From
$header="from: $name <$mail_from>";

// Enter your email address
$to ='';


// Check, if  message sent to your email
// display message "We've recived your information"
echo "We've recived your contact information";
else {
echo "ERROR";

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s