Creating Simple PHP Contact Form

Posted on 14. Jun, 2010 by in 3d Graphics, Freebees, Graphics, Photoshop, Templates, Tutorial, Vector, Wallpapers

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>&nbsp;</td>

<td>&nbsp;</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 …

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • StumbleUpon
  • Reddit
  • BlinkList
  • DZone
  • Facebook
  • Furl
  • Google Bookmarks
  • LinkedIn
  • Live-MSN
  • Mixx
  • MySpace
  • NewsVine
  • Propeller
  • Sphinn
  • Technorati
  • TwitThis
  • YahooBuzz

Related Posts:


Tags: , , , , ,

20 Comments

  1. [...] Creating Simple PHP Contact Form Sharevar fbShare = {url: 'http://bloglinks.ejazahmad.com/creating-simple-php-contact-form/',size: 'large',}Save submit_url = 'http://bloglinks.ejazahmad.com/creating-simple-php-contact-form/'; VN:F [1.9.1_1087]please wait…Rating: 0.0/10 (0 votes cast)VN:F [1.9.1_1087]Rating: 0 (from 0 votes) 3D, Design, Directory, Graphic Design, PHP, Photoshop, Templates, Vector [...]

  2. Kris

    15. Jun, 2010

    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

  3. Cerah

    16. Jun, 2010

    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.

  4. anxiety disorders

    17. Jun, 2010

    Yea, this blog site is by significantly an individual of the ideal anywhere that I’ve observed. Kudos so significantly for assisting me out.

  5. Shelly Casper

    17. Jun, 2010

    Your blog is so informative ¡­ keep up the good work!!!!

  6. Edmond Goffer

    17. Jun, 2010

    I would like to say thank you for your posting about treating anxiety and panic attack!

  7. bzqdhbszdck

    18. Jun, 2010

    JN7ssA iuraglcpdrjs, [url=http://lpvtizywxnzs.com/]lpvtizywxnzs[/url], [link=http://ssbzwmxghvoa.com/]ssbzwmxghvoa[/link], http://jhepuyupetll.com/

  8. [...] This post was mentioned on Twitter by mubashir, designscollage. designscollage said: http://www.designscollage.com/2010/06/creating-simple-php-contact-form/ [...]

  9. Dallas Cathy

    23. Jun, 2010

    hi,The Motif of your blog is very Suit to me, I hope more alternate with you this Subject.

  10. Club Penguin

    24. Jun, 2010

    hey, I added ur site to my RSS reader. the posts are awesome! :)

  11. islami sohbet

    26. Jun, 2010

    Thanks for writing. I worked a lot of work

  12. wow borrow someone gold

    27. Jun, 2010

    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!

  13. 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.

  14. pharmacy technician jobs

    30. Jun, 2010

    My cousin recommended this blog and she was totally right keep up the fantastic work!

  15. axgrptb

    05. Jul, 2010

    SobmSM fwniekaxaijh, [url=http://npjwgdmffhov.com/]npjwgdmffhov[/url], [link=http://ceveeuvghyay.com/]ceveeuvghyay[/link], http://gwagzcqmghwg.com/

  16. Wayne

    04. Aug, 2010

    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?

  17. [...] 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. [...] View full post on Designs Collage [...]

  18. Breanna Romo

    12. Sep, 2010

    amazing news brother

  19. Neomi Jalonen

    28. Sep, 2010

    Fantastic website, where did you get the theme?
    Dub Turbo Beatmaker Software Review

  20. [...] Creating Simple PHP Contact Form [...]

Leave a Reply

Get Adobe Flash playerPlugin by wpburn.com wordpress themes