(Contactus script) Build PHP Database Driven Websites – Tutorial 3a
Previously we had build the database structure, CMS and website interface for an online egames website and now we will develop a contactus script for the same.
Recap:
- We are building a simple ecommerce dynamic website called games
- So far we have build a database structure, CMS and website interface .
- Download file 75.rar. “start” folder consist of the work done previously and “final” folder consist of the complete work done in this tutorial
Note: I would like to point out that this contact script will work only on your website server and not on your local computer. So upload the script before you test!!!! Contactus Script Consists of two pages contact.php (HTML Form) and send.php (script)
contact.php
Type <SCRIPT language="JavaScript" src="gen_validatorv1.js" type="text/javascript"></SCRIPT> in the <head></head>
Find <!— listing —> and type the following:
Explanation
| Code | Explanation |
<SCRIPT language="JavaScript" src="gen_validatorv1.js" type="text/javascript"></SCRIPT> |
Javascript for validation purpose only |
<input type="text" name="username" width="350"/> |
HTML form elements to be passed on to send.php |
send.php
Find <!— listing —> and type the following:
Explanation
| Code | Explanation |
$name=$_POST["username"]; |
Extracting values from the previous form |
$to= "info@phpjavascript.com"; |
setting up variables for mail() function |
mail($to,$subject,$body,$headers) |
PHP mail() function |