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">


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 O’Reilly online learning.

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