1. We are going to be working with the $_Post or $_Get arrays. They basically tell the form if i needs to post something, or get something. In this case we are going to be showing you the basics of a contact email form, so we will be using the $_Post array. Lets create a new file and name it form.php. Below is an example of a simple form asking for name and email address, so lets copy and paste that into the blank file.
|
<form id="userDetails" name="userDetails" method="post" action="sent.php"> Your Name:
<input type="text" size="45" value="" name="name"> E-mail Address: <input type="text" size="200" value="" name="email"> <input type="submit" value="Send" name="validate"> |
2. Now we are going to be displaying this information on the sent page. If you notice, on the above form the action will (on send) redirect you to the defined page. We called that page Sent.php so lets create a new file called sent.php and paste the following code.
|
<?php
print "Welcome " . $_POST [ "name" ] . "<br>" ; print "I see you are " . $_POST [ "age" ] . " years old! <br>" ; ?> |
3. For an extra feature you have the option of having users confirm their submission by changing the action in step one and have it redirect to say confim.php. You can create a blank file and name it (confim.php) and then simply add this form and a link to sent.php so they know that their message was successfully sent.
|
<?php
print "Are you sure you would like to submit this information ? <br>" ; reset ( $_POST ); while(list( $key , $val ) = each ( $_POST )) print $key . " = " . $val . "<br>" ; ?> |



