O'Reilly logo

Building PHP Applications with Symfony™, CakePHP, and Zend® Framework by Leszek Nowak, Karol Przystalski, Bartosz Porebski

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 5. Forms

Computers are like Old Testament gods; lots of rules and no mercy.

Joseph Campbell

WHAT'S IN THIS CHAPTER?

  • Field validation.

  • Customizing forms.

  • Using Captcha as spam protection.

Input forms have become so common and natural that users probably do not even notice when they fill them in. There is also nothing strange about a form noticing that our e-mail address is incorrect or requesting us to write down some barely recognizable characters. This chapter explores forms: form creation and the various common tasks associated with them, such as customization and validation. Several automatic functions of frameworks regarding building forms and their validation are presented here as well.

Web forms can be found at various websites throughout the Internet. They are used in all sorts of situations, allowing users to pass data that is later processed by server-side scripts. By including forms in your web application, you allow visitors to register and enter their unique content. Furthermore, forms can also be used for ordering various products online, voting in polls, and other sorts of user input. In some situations, forms can also be used when you must implement some mechanisms to ensure the security of transmitted data. (More about form security and secured connections can be found in Chapter 8.) This chapter focuses on form validation and customization. We also discuss Captcha tests as a spam protection instrument.

FIELD VALIDATION

One of the most important parts of any web ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required