Llamasery.com Home  
 
Server-side Starter Tutorial: - Part 1 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

Tell a Friend

Everybody needs a 'tell-a-friend' thing on their web site. What's a 'tell-a-friend'? It's a small form that (you hope) one of your site's visitors will fill out to tell one of their friends about your site.

And the T-A-F consists of two parts: a simple HTML form that visitors can use to enter their friend's e-mail address; and a simple php script that sends an e-mail to that address with a message (from us) to visit our site.

Sure, that's trivial. But remember our purpose is to develop a simple application as a simple exercise in confidence-building, and then add bells and whistles (later in the tutorials - much later).

Step 1 - getting the information

In order to 'tell a friend', we need some information about the friend. For now, we'll just get the friend's e-mail address. And to do that, we'll use a standard html form. Later in this tutorial we'll extend that form to make it more useful.

<form action="taf.php" method="post">
Enter your friend's e-mail:  
<input type="text" name="friend_email" size="20" /><br />
<input type="submit" name="submit" value="Send" />
</form>

Create that form using a text editor (or whatever), and save it as taf.html.

That was simple enough! Once that send button is clicked, the form input collected is sent (posted) to the script named taf.php. And then the fun begins ...

  next  »