Page 1 of 1

help with processing lists

Posted: Mon Aug 04, 2003 6:51 am
by vangelis
Hi all. I have created a multiple selection list on an html page and need to process that list using php.

the example list is something like:

<select name=list2 size=5 multiple>
<option value=football>football</option>
<option value=basketball>basketball</option>
<option value=voleyball>voleyball</option>
</select>

However, using import_request_variables does not pass a variable for list2, except if a i have one value selected in which case that value is passed. If i have multiple values selected before i submit the form only the last value is passed.

any ideas on how i can obtain all values included in the list????

Posted: Mon Aug 04, 2003 9:40 am
by Stoker
Have a look in the manual chapter 51

Posted: Mon Aug 04, 2003 1:42 pm
by m3rajk
becuase where there's more than one it's trying to pass an array. instead make it list2[] which makes it an array and makes the passing possible.

Posted: Tue Aug 05, 2003 2:36 am
by vangelis
Thanx guys...I dont know what I would do without you :)

Posted: Tue Aug 05, 2003 10:02 am
by m3rajk
go insane until you stumbled across it by accident and never realize that you had to signify it's an array in the html :-P


i don't understand why, but i haven't seen it in any book. you'd think that'd be covered int he"web basics" at the begining

Posted: Tue Aug 05, 2003 4:00 pm
by vangelis
It seems i was in a hurry to speak... I get all the elements of the list provided that i have them selected from the submition page :evil:
I still cant get them without selecting them all!!!

Posted: Wed Aug 06, 2003 9:08 am
by Stoker
huh?
You want all the items in a list even if they have not been selected? That doesnt make sense

Posted: Wed Aug 06, 2003 11:36 am
by m3rajk
because html is only passing what's been selected. if you want to go through them individually, change to a set of check boxes, and have an array index on each box, thus, list2[] becomes list[array_index_num] and the only ones with a value (well, you might have an empty string ('') in the others) will be those selected