11.07.2015 Views

PHP MySQL - Stilson.net

PHP MySQL - Stilson.net

PHP MySQL - Stilson.net

SHOW MORE
SHOW LESS
  • No tags were found...

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

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

www.it-ebooks.infoCHAPTER 13• WORKING WITH HTML FORMSThe HTML for the multiple-select box shown in Figure 13-1 might look like this:C#JavaScriptPerl<strong>PHP</strong>Because these components are multivalued, the form processor must be able to recognize that theremay be several values assigned to a single form variable. In the preceding examples, note that both usethe name languages to reference several language entries. How does <strong>PHP</strong> handle the matter? Perhapsnot surprisingly, by considering it an array. To make <strong>PHP</strong> recognize that several values may be assignedto a single form variable, you need to make a minor change to the form item name, appending a pair ofsquare brackets to it. Therefore, instead of languages, the name would read languages[]. Once renamed,<strong>PHP</strong> will treat the posted variable just like any other array. Consider this example:

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

Saved successfully!

Ooh no, something went wrong!