How to Create a Contact Us Form for Your Website – 7 steps

Have you ever wanted to ask a question from a website and discovered there was no way to contact the site owner?

They didn’ t have an email address or contact us form on any of their web pages. This would prevent visitors from doing business with this website because it gives the impression they have something to hide and therefore cannot be trusted.

A live (hyperlinked) email address placed on a website can easily be spammed or harvested by spammers. Creating a contact us form is the best solution.

How to Create a Contact Us Form for Your Website

We’ll be using a free PHP script that can quickly and easily be added to any of your webs pages to collect information from your visitors.


  • Linux server with PHP4 or higher installed (most popular servers have this already)
  • PHP script
  • HTML page (where your contact us form is located)
  • Thankyou page (to confirm subscriptions)

1. Get the script code

Go to to get the code for the script. Copy and paste (select all) the entire code into Notepad (o text editor) and save it as securemail.php

2. Edit the script

i) Replace this line with the email address or addresses you wish to use to receive the results of the form.

$recipient = ““;

ii) Replace with the website address where the form is located.

$referers = array (‘‘);

3. Create an HTML web page and insert the form code

Create a web page (e.g. contact.htm) that contains the html form code.

Here’s the sample code of the form above that collects the name and email address of your website visitors. Replace with your own website address.

<title>Contact Us</title>
<body bgcolor="#FFFFFF" text="#000000">
<form name="Contact Us" method="post" action="">
<input type=hidden name="subject" value="Contact Us Form Results">
<input type=hidden name="required" value="fullname,email">
<input type=hidden name="redirect" value="">
Full Name<br>
<input type=text name="fullname">
Email Address<br>
<input type=text name="email">
<textarea name="comments"></textarea>
<input type="submit" name="Submit" value="Submit">

Explanation of code

  • method=post action refers to the form location on the server.
  • hidden name=”subject” value refers to the name of your form and how it will appear in the form results
  • hidden name=”required refers to the fields required to be filled out on the form. If they don’t get filled out the form will cannot be submitted.
  • Remove this line of code if you don’t want required fields.
  • hidden name=”redirect” refers to the page visitors get redirected to after submitting the form.

4. Create a thankyou.htm page

Your visitor will receive this page after submitting the contact us form.

Write something like “Thank you for subscribing!” to confirm your visitor successfully subscribed.

5. Add additional form fields

You don’t have to be limited to name and email address. Other form fields can easily be added to the form (e.g. phone number, address, etc)

6. Upload files to the server

Upload securemail.php, contact.htm, thankyou.htm to the server using your FTP software (e.g. Filezilla, SmartFTP).

7. Test your contact us form

Go to the web page containing your contact us form, enter your name and email address, then click on the submit button. You should immediately receive the thankyou.htm page. Check your email inbox to view the contact form results. If you receive any errors check the script edits, html in your form and that you’ve uploaded your files correctly.

Place a contact form on every web page because visitors may enter your website from any page. Create an incentive for visitors to subscribe by offering an free report. This will help build your email subscriber list.

And now I would like to invite you to claim your FREE report titled:
7 Habits of Highly Effective Traffic Generation

Herman Drost is the owner and author of
Web Design, SEO, Article Marketing


  1. nice post. good luck with the blog and keep up the good content coming.

  2. Thanks for your words of encouragement!

  3. Superb Blog, you have a new follower now

  4. Lots of Fantastic information in your blogpost, I favorited your blog so I can visit again in the future, All the Best, Rubie Hogains

  5. I imagine it is. Very good stuff, glad I found this.

  6. Thank you for this nice post.

  7. Thanks for the info. 😀

  8. Thanks for the info. 😀

  9. I tried to subscribe to your rss, but had a difficulty adding it to google reader. Could you please check this out.

  10. Success in any business will not happen overnight. It still takes time and work to get your affiliate marketing strategy up and running. Nevertheless, if you are determined, decided and ready to give it your all, affiliate marketing can be the perfect career chance for you.

  11. I¡¯ve been reading along for a while now. I just wanted to drop you a comment to say keep up the good work.

  12. I’m agree with you, here we learn about very well features. I should just give up and take lessons from you 🙂

  13. Great information! I’ve been looking for something like this for a while now. Thanks! Roberto Justus

  14. Thanks for taking the time to share this with us, just loved it.

  15. can i bookmark this site for future reference? i really like this info that you give

  16. Yes please Damien…go ahead.

  17. Hi, Whats up? Thanks for this good stuff. I am looking for some help from your articles as I learn how to earn extra money at home.

  18. I’ve heard of this before, but is it worth the price?

  19. Hi, I am glad to find so many useful info here, this is a really great website. Thanks a lot for this amazing good posts! I will bookmark your site and take the feeds also… I hope you will keep updating your posts constantly as you have one dedicated reader here.

  20. I do not really have a good deal to say in reply, I only this minute want to comment to say great job. It looks like you’ve put a good amount of effort into your post and we require much more of these on the net nowadays.

  21. I am very thankful to this topic because it really gives great information ;*”


  1. […] If you’re using an autoresponder service such as Aweber they’ll provide the html code to insert on your web page. If you wish to create your own form go to: How to Create a Contact Us Form for Your Website […]

Speak Your Mind