O'Reilly logo

MySQL Cookbook, 3rd Edition by Paul DuBois

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 20. Processing Web Input with MySQL

Introduction

The previous chapter describes how to retrieve information from MySQL and display it in web pages using HTML constructs such as tables or hyperlinks. That’s a use of MySQL to send information in one direction (from web server to user). This chapter considers the use of MySQL in the other direction: web-based database programming to collect information sent from user to web server, such as the contents of a submitted form. For example, you might store the information from a survey form for later use, or use keywords from a lookup form as the basis for a query to search the database for information the user wants.

MySQL comes into these activities as the repository for storing information or as the source from which search results are drawn. But before you can process input from a form, you must create the form and send it to the user. MySQL helps with this, too, because it’s often possible to use information from your database to generate form elements such as radio buttons, checkboxes, pop-up menus, or scrolling lists:

  • Select a set of items from a table that lists countries, states, or provinces and convert them into a pop-up menu in a form that collects address information.

  • Use the list of legal values for an ENUM column that contains permitted colors or sizes to generate a set of radio buttons.

  • Use lists of available colors, sizes, or styles stored in an inventory database to construct fields for a clothing ordering form.

Using ...

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