Multiple Selections from List Box

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm creating some multiple selection list boxes. 

I believe this would be close to the correct code to
pull the selections:

  <select name="select" size="3" multiple="multiple">
    <?php $arrayselect = explode(" ", "Please
Select"); ?>
    <option value="NY" <?php for ($i=0;
$i<sizeof($arrayselect); $i++) {if ("NY" ==
$arrayselect[$i]) {echo "selected"; break;}}?>>New
York</option>
    <option value="SF" <?php for ($i=0;
$i<sizeof($arrayselect); $i++) {if ("SF" ==
$arrayselect[$i]) {echo "selected"; break;}}?>>San
Francisco</option>
    <option value="LA" <?php for ($i=0;
$i<sizeof($arrayselect); $i++) {if ("LA" ==
$arrayselect[$i]) {echo "selected"; break;}}?>>Los
Angeles</option>
    <option value="DC" <?php for ($i=0;
$i<sizeof($arrayselect); $i++) {if ("DC" ==
$arrayselect[$i]) {echo "selected";
break;}}?>>Washington D.C.</option>
  </select>
</form>

The values from the table are stores by valueID and
Label.  Not sure if I need some kind of delimiter in
my code ?

Also, what is the most effective way to store the
selections in the database ? I'm assuming it would be
an "enum" column.   

Stuart

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux