05.05.2013 Views

Programming PHP

Programming PHP

Programming PHP

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Example 7-6. Multiple selection values with a select box (continued)<br />

Perky<br />

Morose<br />

Thinking<br />

Feeling<br />

Spend-thrift<br />

Shopper<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

In Example 7-6, the submit button has a name, "s". We check for the presence of this<br />

parameter value to see whether we have to produce a personality description.<br />

Figure 7-3 shows the multiple selection page and the resulting output.<br />

Figure 7-3. Multiple selection and its output<br />

The same technique applies for any form field where multiple values can be returned.<br />

Example 7-7 shows a revised version of our personality form that is rewritten to use<br />

checkboxes instead of a select box. Notice that only the HTML has changed—the<br />

code to process the form doesn’t need to know whether the multiple values came<br />

from checkboxes or a select box.<br />

This is the Title of the Book, eMatter Edition<br />

Copyright © 2002 O’Reilly & Associates, Inc. All rights reserved.<br />

Processing Forms | 169

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!