Llamasery.com Home  
 
Server-side Starter Tutorial: The Contact Form - Part 2 of 6
Alfie the alpha_geek: Llamasery guru-in-waiting Tutorials Purpose

Starter Tutorials

Tell-a-Friend
Tell-a-Friend +
The 'Contact Form'
php Includes
Simple Themes
MySQL database 101
Comments System
Text Files

Intermediate Material

Articles/Tutorials

Our contact form code - HTML section

Here's the form code we'll use for the tutorial. It may not be the prettiest code you ever saw, but it'll serve for this tutorial. Copy/paste it and save it as contact.html on your server if you want to test this script.

<form action="contact.php" method="post">
Enter your name:<br />
<input type="text" name="visitor_name" size="20"><br /><br />
Enter your e-mail address:<br />
<input type="text" name="visitor_email" size="20"><br /><br />
Choose a subject for your message:<br />
<select name="subject">
<option selected value="General Comment">General</option>
<option value="Information">Information</option>
<option value="Complaint">Complaint</option>
</select><br /> <br />
Choose a recipient for your message: <br />
<select name="whofor">
<option selected value="1">Webmaster</option>
<option value="2">Sales Team</option>
<option value="3">Service Team</option>
</select>
<br /> <br />
Enter your comments: <br />
<textarea name="comments" cols="40" rows="5"></textarea>
<br /> <br />
<input type="submit" value="Send">
</form>

Extra stuff

Apart from those inputs to be used by our site visitor, we'll also add the IP address of the visitor and the time that the message was sent. We'll use php directly to acquire that information:

«  previous  |  next  »