Database Reference
In-Depth Information
<form action= " <%= request . getRequestURI () %> " method= "post" >
<%- - ... generate form elements here ... -- %>
</form>
See Also
The examples shown in this section have an empty body between the opening and
closing form tags. For a form to be useful, you must create body elements that corre‐
spond to the types of information to be obtained from users. It's possible to hardwire
these elements into a script, but Recipes 20.2 and 20.3 describe how MySQL helps you
create the elements on the fly from information stored in your database.
20.2. Creating Single-Pick Form Elements from Database
Content
Problem
A form must present a field that enables the user to select one of several options.
Solution
Use a single-pick list element. These include radio button sets, pop-up menus, and
scrolling lists.
Discussion
Single-pick form elements enable you to present multiple choices from which a single
option can be selected. Our construct-a-cow scenario (see Recipe 20.0 ) involves several
sets of single-pick choices:
• The list of colors in the cow_color table. These can be obtained with the following
statement:
mysql> SELECT color FROM cow_color ORDER BY color;
+---------------+
| color |
+---------------+
| Black |
| Black & White |
| Brown |
| Cream |
| Red |
| Red & White |
| See-Through |
+---------------+
Search WWH ::




Custom Search