Chapter 9. Adding HTML forms to a Web Page

Display an HTML Form

HTML forms are very important for dynamic Web sites. Users type or select information in the form and submit the form by clicking a button, and the user information is passed to a program that processes it. The program can store the information in a database or use it in conditional statements to deliver individualized Web pages to the user.

To display a form on a Web page, the HTML code is included in the program in an HTML section of the script or echoed in a PHP section. A form has the following general format:

<form action="programname.php" method =
"POST">

   form fields

   submit button

</form>

The form fields can be text fields, check boxes, radio buttons, drop-down lists, or hidden ...

Get PHP & MySQL®: Your visual blueprint™ for creating dynamic, database-driven Web sites 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.