#native_company# #native_desc#

Arrays, HTML and PHP

By Tim Perdue
on July 30, 2000

Sorry I haven’t updated PHPBuilder is SO long, but I’ve been a bit busy
helping build a new web site called SourceForge.
While building the site, I stretched my knowledge of PHP and databases and thought
I would share a few things I learned.
A lot of people ask about passing arrays and using checkboxes/select boxes in PHP,
so that’s what I’ll cover today.
To pass multiple values, as in a “Multiple Select Box”, put [] after the variable name,
like assigned_to[].

<SELECT NAME="assigned_to[]" MULTIPLE SIZE="8">

    <OPTION VALUE="100">None</OPTION>

    <OPTION VALUE="2">dtype</OPTION>

    <OPTION VALUE="4">tim_perdue</OPTION>

    <OPTION VALUE="5">fusion94</OPTION>

    <OPTION VALUE="3">precision</OPTION>

    <OPTION VALUE="18">michael</OPTION>

    <OPTION VALUE="157">jbyers</OPTION>

    <OPTION VALUE="251">Lectric</OPTION>

    <OPTION VALUE="149">baddog</OPTION>

    <OPTION VALUE="105">mrzenn</OPTION>


Then on the receiving page, you simply do a count() on assigned_to, and iterate
through the list of values that was selected.



for ($i=0$i<$count$i++) {