• Home
  • Download Free eBook
  • OC Archives
  • Tools I Use
  • Webmaster Forum
  • Write For Us
Logo

  • Discounts
  • SEO Central
    • All other Search
    • Bing
    • Google Central
    • Yahoo
  • Social Networks
    • Digg
    • facebook
    • Squidoo
    • Technorati
    • Twitter
  • Web Design & Development
    • Ajax
    • Coding
    • Database
    • Graphic Design
    • Joomla
    • jQuery
    • OScommerce
    • Photoshop
  • Webmaster Central
    • Author's Corner
    • Case Studies
    • Content Writing
    • Featured Interviews
    • Guest Posts
    • Make Money Online
    • OC Promos
    • Premium Reviews
    • Video Tutorials
    • Web Hosting
    • Web News
    • Web Security
  • Wordpress

Simple PHP contact form That Works !!

Posted by Joshu on Dec 16, 2009 in Coding, Tutorials | 0 comments

It was always a Challenge on the web for me in my initial days of web development to find a “Working” PHP contact form, Sometimes if its working its difficult to customize, Some looks good but does not work.

With this article  you can either directly Paste the HTML code in your Contact page ( with a HTML editor) and use it.
Files required

1. contact.html
2. contact.php
3. thankyou.html

Steps

include the source code of the <form> </form> part in your custom designed contact form or use the contact.htm

upload the contact.php file to the same level of the contact.htm in your FTP

Configure the contact.php with the destination email address, Contact form subject and From ( NOTE: the from address should be a email adress @ the domain name of the site itself)

upload a thankyou.html that will be the redirection page to show thankyou for contacting us message

How it works

- please carefully read through the variables used in the contact form HTML
- The entered data is transfered into variables and transfered to the php form that will have a function that sends the email with the variables in the body

So make sure you dont change any variable fields unless you know what you are doing.
Also if you want to add an extra field or remove a filed, make sure that you add or remove the corresponding variable as well

I hope i was able to make it simple if you have any questions, please add a comment , i would be happy to help.

contact.php is given below

<?php
$file=”thankyou.htm”;
if(isset($_POST['submit'])) {
$from = “admin@domainname.com“;
$to = “personalid@gmail.com“;
$subject = “Orangecopper.com  form”;
$name1_field = $_POST['firstname'];
$name2_field = $_POST['lastname'];
$email_field = $_POST['email'];
$job_field = $_POST['jobtitle'];
$company_field = $_POST['company'];
$phone_field = $_POST['phone'];
$country_field = $_POST['country'];
$function_field = $_POST['function'];
$nature_field = $_POST['nature'];
$message = $_POST['message'];
$contact_field = $_POST['contactback'];
$body = “From: $name1_field\n Email: $email_field\n Job Title: $job_field\n Phone: $phone_field\n Country: $country_field\n Function: $function_field\n NatureOfBiz: $nature_field\n Message:\n $message\n Contact back: $contact_field”;
 
include(“$file”);
mail($to, $subject, $body,”From:”.$from);
} else {
echo “ERROR!!, please re check and resubmit”;
}
?>

[ratings]


Related Articles You Are Probably Interested In:

  1. Best Contact form plugin for wordpress
  2. Oscommerce Contact form issues
  3. How to modify the WordPress comment Form
  4. 6 Best free Auto form filling Firefox addons
  5. What is WP MU and Buddypress , How is it different form WordPress
  6. 5 Simple steps to set up your Squidoo Lens
  7. 4 Simple tools for smart blogging
  8. A Simple Client Questionnaire for a web design company

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

*

*

CAPTCHA Image
Refresh Image

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

 Subscribe to OC Blog! 

Subscribe to OC Blog

Stay tuned to the Latest updates and tips in the Webmaster World




Most Popular Posts

  • List of High PR do follow blogs (Verified) (305)
  • Next Google Page rank - PR update 2011 (278)
  • Market Samurai Discount – Save 80 USD! (234)
  • 300 High paying adsense keywords 2011 (104)
  • List of High PR Dofollow Directories 2011 (88)
  • 22 OpenSource Forum Scripts - Details and Download: update list (82)
  • Best Classifieds Ads Scripts (75)
  • How to modify the Wordpress comment Form (65)
  • Review of the List of the Best Social Networking websites 2011 (61)
  • List of 200 Highest paying Adsense Keywords : Updated list 2010 (44)
  • 10 Best Premium Wordpress Plugins (43)
  • Featured Interviews: Harsh Agarwal from ShoutMeLoud.com (43)
  • Elegant Themes Discount 2011 (Save 10 USD) (42)
  • List of all Top Social Networking websites as on 2010 (38)
  • One of the Biggest SEO Secret for Linkbuilding (37)
  • 14 Best Ajax Scripts to use for any website (37)
  • Download KeywordLuv WordPress Plugin (37)
  • How i earn Big Bucks from my blog Doing Nothing! (37)
  • Fatal Error on WordPress 3.3 Version Upgrade (37)
  • 30 Best wordpress Plugins required for Any WP Blog (36)
About OrangeCopper Network 

Who am I? Am Joshu. I enjoy blogging about webmaster related stuff and technology. Xtras - I Design, Develop, Blog and Support the Open Source. Passions: I Love Music, Photography, Design, Development, Cycling, Travelling and sleeping (Favorite)

What i could do for you: Ive been working on various shades of the web for over 11 years now and learned the hard way, Now i could help you learn it the Easy way. OrangeCopper is a Webmaster community that i started in the year 2002 and is now a platform for webmasters around the world. Thankyou for spending your time to visit Blog. I would love to get connected every webmaster reading this, follow me on Twitter and i would auto follow you. Thanks again, Happy Surfing!

Interested to Learn Professional Blogging? Check out my NapIncome Blog where I share all the secrets to build a professional blog and earn money from ProBlogging.

Please Subscribe to the Blog Newsletter to get regular weekly update
Twitter: http://www.twitter.com/orangecopper | Subscribe to feeds : http://feeds.feedburner.com/orangecopper/ilRl

Other OrangeCopper Network Websites

ConnectRing Web Directory | UsedMobiles.in | UsedGadgets.in | NapIncome Strategy Blog | HippieMonk Technology Blog | All Good WordPress Themes | PixelTribes Photography Blog | Yscream Web Hosting

Favorite Articles

  • List Of Best Classifieds Ads Scripts Ever (Free & premium)
  • How to triple your Blog Subscription rates / opt-ins – It Worked for me!
  • You can certainly spend Half a Dollar For creating a GREAT Blog
  • How i earn Big Bucks from my blog Doing Nothing!
  • 35 best free wordpress themes for download: updated list 2010
  • 22 Web 2.0 Colors and their codes in HTML
  • 48+ web Design Related Twitter Accounts To Follow
  • Make a web 2 icon with Photoshop in easy 8 steps
  • List of 62 Free Press Release websites

    Most Rated Articles

  • Compare WordPress – Joomla – Drupal and their features
  • 7 Excellent jQuery menus and jQuery examples and downloads
  • 5 Most Important To Do s for a New Blog Launch
  • How to colorize with adobe Photoshop
  • Free Magento Themes / Templates Download: updated list
  • How to install wordpress step by step tutorial
  • List of 200 Highest paying Adsense Keywords : Updated list 2010
  • How to display Exit Splash or Exit message for website
  • How to promote your old Blog posts