I have made a tutorial about how to install EasyPhp and now i come with an example. Today we learn how to create a Contact Page in HTML and PHP very easy! Download the next files to exercise on them:
bg.gif
index.php
send.php
Download: here
1. Let's write the index.php / Here we use HTML
| <html> <head> <title>Contact</title> </head> <body> <body background="bg.gif"> <form action="send.php" method="post"> <pre> <center> <br> <br> <input type="text" name="email" value=""><br> Name <input type="text" name="name" value=""><br> Surname <input type="text" name="surname" value=""><br> Subject <input type="text" name="subject" value=""><br> Message<br> <textarea name="message" cols="60" rows="6"></textarea><br><br> <input type="submit" name="Send" value="Send"><input type="reset" name="Clear" value="Clear"> </form> </body> </html> |
Save this like index.php
2. Here we write the send.php page
| <?php if(($_POST['email'] == ") || ($_POST['name'] == ") || (is_numeric($_POST['name'])) || ($_POST['surname'] == ") || (is_numeric($_POST['surname'])) || ($_POST['subject'] == ") || ($_POST['message'] == ")) { echo 'Complete the forms correctly <br> Click <a href="index.php" mce_href="index.php">here</a> to return on main page.'; } else { $to = 'piticstyle@yahoo.com'; // change e-mail adress $send_date = date('d-m-Y H:i:s'); $subject = $_POST['subject']; $message = ' <html> <head> <title>Contact</title> </head> <body> <p><tt>Send Date: '.$send_date.' </tt></p> <table> <tr> <td><tt> Name: '.$_POST['name'].' </tt></td> </tr> <tr> <td><tt> Surname: '.$_POST['surname'].' </tt></td> </tr> <tr> <td><tt> E-Mail: <a href="mailto:'.$_POST['email'].'" mce_href="mailto:'.$_POST['email'].'">'.$_POST['email'].'</a> </tt></td> </tr> <tr> <td><tt> Message: <br><br> '.$_POST['message'].' </tt></td> </tr> </table> </body> </html>'; $headere = "MIME-Version: 1.0rn"; $headere .= "Content-type: text/html; charset=iso-8859-1rn"; $headere .= "From: ".$_POST['name']." ".$_POST['surname']."<".$_POST['email'].">rn"; mail($to, $subject, $message, $headere); echo 'The message was send'; } ?> |
Save this like send.php
3. Test your contact page:
To test your contact page you need to upload the files on a server. If you dont have your own server & domain name, search on internet websites who give free host with the option to have acces on the ftp. I found a site:
If you don't understand something please write a comment, thank you for your attention and check this tutorial to learn how to install EasyPHP (Php, MySQL, Apache, PhpMyAdmin). Here is the final result.

Related Articles
- Domain Names - Free Privacy - How to Protect your Privacy When You Register a Domain NameAre you worried about your privacy online when starting a website? You should be. When you register domain names - free privacy settings from your registrar can protect you from spam, prying eyes, or worse.
- PHP Contact FormFirst, lets create the html section. I made a simple form, but it gets the job done. You can customize it if you want, but remember to use the same form variables.
- How to make a simple form mailer with PHPAs you may be well aware, displaying your e-mail address on your website can lead to e-mail harvesters picking up your address and adding it to hundreds or even thousands of lists used by spammers...
- Simple Contact FormLearn how to write a clean and easy contact form for your site.
- E-mail form using HTML and PHPSometimes its a nice touch to include an e-mail feedback form on your contact page or elsewhere on your web site. Lets create an e-mail form using html and a simple php script to send it along.
- Top 7 Web Domain Name Registration MistakesPicking the right domain name can often be hard to do. Take a look at this article to find out the 7 big mistakes people often make when choosing a domain name.
- Stop SpamPreventing your e-mail that you placed on your site from being found by spammers is very hard. Some have even taken their e-mail addresses off their sites and replaced them with contact forms to prevent this. Here is a neat .htaccess method to help put a stop to this. This will stop many of the bo....
- How To Create And Send HTML NewslettersEvery now and then a subscriber will ask how I create my newsletter. Fortunately, this request is done in conjunction with a complement I humbly accept.
- Dealing with Requests in ASPThis tutorial will show you how to change the location of an iFrame using requests in one file.
- Update Your Site Instantly With SSIThere are probably two main ways you currently update your site. The first, and most important, is adding new content. Whether you are updating a calendar, adding a new page, or putting in a photo of a new product, you are enhancing the value of your site for your visitors. The second, and more t...
