Creating an HTML Form

Managing HTML forms with PHP is a two-step process. First you create the HTML form itself, using any text or WYSIWYG editor you choose. Then, you create the appropriate PHP script that receives the form data.

It would be outside the realm of this book to go into HTML forms in any detail, but I will lead you through one quick example so that it may be used throughout the chapter.

An HTML form is created using the form tags and various input types. The form tags look like

<form action="script.php" method="post">
</form>

The most important attribute of your form tag is the action, which dictates to which page the form data will be sent. The second attribute—method—has its own issues (see the Choosing a Method sidebar), but ...

Get PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.