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 corresponding PHP script that will receive and process 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 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 ...

Get PHP and MySQL for Dynamic Web Sites: Visual Quickpro Guide, Second 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.