Share this Page URL

Chapter 12. Need Feedback? Create a Form! > Creating a Form - Pg. 130

Need Feedback? Create a Form! 130 Here, the ACTION attribute tells the browser where to send the form's data. This is almost always a program (or script, as they're often called) that processes the data and then performs some kind of action (hence the name). The url is the address of the script file that contains the program. The METHOD attribute tells the browser how to send the form's data to the URL specified with ACTION. You have two choices here for METHOD: POST and GET. The method you use depends on the script, but POST is the most common method. Let's bring all this gobbledygook down to earth with a concrete example. You can test your forms by using a special script that I host on my server. Here's how to use it: <FORM ACTION="" METHOD="POST"> What this script does is return a page that shows you the data that you entered into the form. You can try this out after you build a working form. Speaking of which, the next few sections take you through the basic form elements. Making It Go: The Submit Button Most dialog boxes, as you probably know from hard-won experience, have an OK command button. Clicking this button says, in effect, "All right, I've made my choices. Now go put everything into effect." Forms also have command buttons, and they come in two flavors: submit buttons and reset buttons. A submit button (I talk about the reset button in the next section) is the form equivalent of an OK dialog box button. When the reader clicks the submit button, the form data is shipped out to the program specified by the <FORM> tag's ACTION attribute. Here's the simplest format for the submit button: