Very simple contact form

Here is an example of using PHP with html form data to make a contact form for a web site. This is also a good example of grabbing HTML form data with PHP and using it.  Here is the demo:



Here is the code:

This is your form. You can add any form tags you like. Change the extension to ‘html’ instead of ‘txt’ if you wanna try it.

Here what does the leg work. The main part of this file is the PHP code. For this to work for you, change the extension from ‘txt’ to ‘php’ then change the email address to your email.


Leave me any questions if your having trouble with it or want to comment on it.


I have since updated the contact form to add some extra CSS properties and I have added Google CAPTCHA to prevent spam. Here is the CSS properties I have added to create slightly more attractive design.

:invalid { 
  border-color: #e88;
  -webkit-box-shadow: 0 0 5px rgba(255, 0, 0, .8);
  -moz-box-shadow: 0 0 5px rbba(255, 0, 0, .8);
  -o-box-shadow: 0 0 5px rbba(255, 0, 0, .8);
  -ms-box-shadow: 0 0 5px rbba(255, 0, 0, .8);
  box-shadow:0 0 5px rgba(255, 0, 0, .8);

:required {
  border-color: #88a;
  -webkit-box-shadow: 0 0 5px rgba(0, 0, 255, .5);
  -moz-box-shadow: 0 0 5px rgba(0, 0, 255, .5);
  -o-box-shadow: 0 0 5px rgba(0, 0, 255, .5);
  -ms-box-shadow: 0 0 5px rgba(0, 0, 255, .5);
  box-shadow: 0 0 5px rgba(0, 0, 255, .5);

form {
  margin: 20px auto;

input {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  border:1px solid #ccc;
  outline: none;


input[type=submit] {

    background-color: #BAC3FF;

form p{

Leave a Reply

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

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>

Graveyard Database Logo

Has everything you want to know about grave yards. Plus has many celebrites and world leaders graves. Pssst it is my other site

Google + Profile
Check out Android Photo Mapping, its a app/site I been working on
Fabulou wholesale Petr Mrazek jersey is back. Best choice to get the wholesale Petr Mrazek jersey is suitable for all style of people.