When you need that user contact with you or send feedback to you via email then you have to need make a contact form. In this tutorial you will learn that how to create form with php script.
Overview
In this tutorial create 2 files 1. contact.php and 2. send_contact.php
Step
1. Create file contact.php.
2. Create file send_contact.php.
Step1:
Create file contact.php
View In Browser
CODE
………………………………………………………………………………………………………………………….
<table
width=”400″ border=”0″ align=”center” cellpadding=”3″
cellspacing=”1″>
<tr>
<td><strong>Contact Form </strong></td>
</tr>
</table>
<table
width=”400″ border=”0″ align=”center” cellpadding=”0″
cellspacing=”1″>
<tr>
<td><form method=”post”
action=”send_contact.php”>
<table width=”100%” border=”0″ cellspacing=”1″ cellpadding=”3″>
<tr>
<td width=”16%”>Subject</td>
<td width=”2%”>:</td>
<td width=”82%”><input name=”subject”
id=”subject” size=”50″></td>
</tr>
<tr>
<td>Detail</td>
<td>:</td>
<td><textarea name=”detail” cols=”50″ rows=”4″
id=”detail”></textarea></td>
</tr>
<tr>
<td>Name</td>
<td>:</td>
<td><input type=”text”
size=”50″></td>
</tr>
<tr>
<td>Email</td>
<td>:</td>
<td><input name=”customer_mail”
id=”customer_mail” size=”50″></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><input name=”Submit” value=”Submit”>
<input name=”Submit2″ value=”Reset”></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
………………………………………………………………………………………………………………………….
Step2:
Create file send_contact.php
CODE
………………………………………………………………………………………………………………………….
<?php
// 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
“We’ve recived your information”
if($send_contact){
echo “We’ve recived your contact information”;
}
else {
echo “ERROR”;
}
?>
………………………………………………………………………………………………………………………….
Apply and Comment …




June 15, 2010 at 8:21 am
2 major issues with this:
1. It won’t work. At no point in send_contact.php are the $_POST vars assigned to the vars that get used in the mail.
2. It’s wide open to header injection. See http://phpsense.com/php/php-mail.html
June 16, 2010 at 11:19 pm
Thank you so much for the tutorial. It was very helpful.
I ended up using http://www.quickwebform.com
It generates a code that I copy and paste my website. Do you know anything about them? It works great and it’s also free.
June 17, 2010 at 5:52 pm
Yea, this blog site is by significantly an individual of the ideal anywhere that I’ve observed. Kudos so significantly for assisting me out.
June 17, 2010 at 6:06 pm
Your blog is so informative ¡ keep up the good work!!!!
June 17, 2010 at 10:49 pm
I would like to say thank you for your posting about treating anxiety and panic attack!
June 18, 2010 at 9:23 pm
JN7ssA iuraglcpdrjs, [url=http://lpvtizywxnzs.com/]lpvtizywxnzs[/url], [link=http://ssbzwmxghvoa.com/]ssbzwmxghvoa[/link], http://jhepuyupetll.com/
June 23, 2010 at 8:13 pm
hi,The Motif of your blog is very Suit to me, I hope more alternate with you this Subject.
June 24, 2010 at 11:23 pm
hey, I added ur site to my RSS reader. the posts are awesome!
June 26, 2010 at 7:08 pm
Thanks for writing. I worked a lot of work
June 27, 2010 at 4:31 pm
Please tell me it worked right? I dont want to sumit it again if i do not have to! Either the blog glitced out or i am an idiot, the second option doesnt surprise me lol. thanks for a great blog!
June 27, 2010 at 8:23 pm
This is a really good read for me, Must admit that you are one of the best bloggers I ever saw.Thanks for posting this informative article.
June 30, 2010 at 12:49 pm
My cousin recommended this blog and she was totally right keep up the fantastic work!
July 5, 2010 at 11:49 pm
SobmSM fwniekaxaijh, [url=http://npjwgdmffhov.com/]npjwgdmffhov[/url], [link=http://ceveeuvghyay.com/]ceveeuvghyay[/link], http://gwagzcqmghwg.com/
August 4, 2010 at 6:45 pm
Thanks Cerah. I tried quickwebform as well and seems to good to be true. In any case, I am using it now and it works great. Do you know of any other solution or tips?
September 12, 2010 at 3:07 am
amazing news brother
September 28, 2010 at 10:14 pm
Fantastic website, where did you get the theme?
Dub Turbo Beatmaker Software Review