7. Form Handling

Any time you need to gather information from the users of your Web sites, you’ll need to use a form.

Forms can contain most of the usual graphical interface elements, including entry fields, radio buttons, check boxes, pop-up menus, and entry lists. In addition, HTML forms can contain password fields, shielding the user’s input from prying eyes.

Once the form is filled out, a click on the form’s Submit button sends the form’s information to your Web server, where a CGI (that stands for Common Gateway Interface, and it’s a script that runs on the Web server) interprets the data and acts on it. Often, the data is then stored in a database for later use. It’s useful to make sure that the data the user enters is “clean,” that is, ...

Get JavaScript and Ajax for the Web: Visual QuickStart Guide, Seventh Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.