Processing User Input

In this section, we build on the querying techniques discussed so far in this chapter. We focus on user-driven querying , in which the user provides data that controls the query process. To input parameters into the querying process, the user usually selects or types data into an HTML form environment, or clicks on links that request scripts.

We show you user-driven querying by introducing how to:

  • Pass data from a web browser to a web server.

  • Access user data in scripts.

  • Secure interactive query systems.

  • Query databases with user data.

  • Process data using one-component querying , where the user clicks on a link that runs a query but leaves the user on the same page. This querying process is often used to add items to a shopping cart.

Passing Data from the Browser to the Server

Three techniques can be used to pass data that drives the querying process in a web database application:

  • Data entry through HTML form environments. For example, form environments can capture textual input, and input is made by selecting radio buttons, selecting one or more items from a drop-down menu, clicking on buttons, or through other data entry widgets.

  • Typing in a URL. For example, a user may open a URL using the Open Page option in the File menu of the Mozilla web browser, and typing in a URL such as http://www.webdatabasebook.com/example.6-10.php?regionName=Riverland.

  • Embedded hypertext links that can be clicked to retrieve a PHP script resource and provide parameters to the script.

Of these, ...

Get Web Database Applications with PHP and MySQL, 2nd 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.