Creating the Form

In Listing 9.11, you see the basic HTML for creating a simple feedback form. This form has an action of listing9.12.php, which we create in the next section. The fields are very simple: Line 7 contains a name field, line 8 contains the return email address field, and line 10 contains the text area for the user's message.

Listing 9.11 Creating a Simple Feedback Form
  1: <HTML>
  2: <HEAD>
  3: <TITLE>E-Mail Form</TITLE>
  4: </HEAD>
  5: <BODY>
  6: <FORM action="listing9.12.php" method="POST">
  7: Your Name: <INPUT type="text" name="name"><br><br>
  8: Your E-Mail Address: <INPUT type="text" name="email"><br><br>
  9: Message:<br>
 10: <textarea name="message" cols=30 rows=5></textarea><br><br>
 11: <INPUT type="submit" value="Send Form">
 12: </FORM>
 13: </BODY>
 14: </HTML>

Put these lines into a text file called listing9.11.php, and place this file in your Web server document root. Now access the script with your Web browser, and you should see something like Figure 9.6.

Figure 9.6. Form created in Listing 9.11.


In the next section, you create the script that sends this form to a recipient.

    Part III: Getting Involved with the Code