Justtechjobs.com Find a programming school near you






Online Campus Both


php-general | 2001092

[PHP] R: multiple selections in list/menu field From: --- (flagzen <email protected>)
Date: 09/17/01

i don't know if it will work, but try to use x[rec_pd4][] as select name
and remember that x[rec_pd4] will result as an array, not a string!!
instead of ==, you can use the in_array function to check if a value is in
the array...

----------------------------
Federico
flagzenNO-SPAM <email protected>
----------------------------

Tom Beidler <tom <email protected>> wrote in message
B7C7EE59.2C7A%tom <email protected>
> I'm trying to use a list/menu field with multiple options allowed but I'm
> only getting the very last selection.
>
> Here's part of my code to build the list/menu field;
>
> print (" <td><select name=\"x[rec_pd4]\" multiple size=\"15\">\n");
> print ("$option_pd4");
> print (" </select></td>\n");
>
> Here's the code to build the options;
>
> $pd4arry = array(array("c1,","Bookpacks & Daypacks"),array("c2,","Mini
> Packs/Diaper Bag"),array("c3,","Shoulder Bags/Briefcase"));
> foreach($pd4arry as $value) {
>
> if (($value[0] == $category_code) || ($value[0] == $x[rec_pd4])) {
> $option_pd4 .= " <option
> value=\"$value[0]\"selected>$value[1]</option>\n";
> } else {
> $option_pd4 .= " <option
> value=\"$value[0]\">$value[1]</option>\n";
> }
> }
>
> The field displays fine but I only get the last option. I'm testing with
IE
> 5.
>
> Let me know if this is not a PHP issue but I thought there might be
> something that would prevent me from using this type of field with PHP.
>
> Thanks,
> Tom
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe <email protected>
For additional commands, e-mail: php-general-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>