help with processing lists

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
vangelis
Forum Newbie
Posts: 23
Joined: Thu Jun 05, 2003 6:35 am

help with processing lists

Post 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????
User avatar
Stoker
Forum Regular
Posts: 782
Joined: Thu Jan 23, 2003 9:45 pm
Location: SWNY
Contact:

Post by Stoker »

Have a look in the manual chapter 51
m3rajk
DevNet Resident
Posts: 1191
Joined: Mon Jun 02, 2003 3:37 pm

Post 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.
vangelis
Forum Newbie
Posts: 23
Joined: Thu Jun 05, 2003 6:35 am

Post by vangelis »

Thanx guys...I dont know what I would do without you :)
m3rajk
DevNet Resident
Posts: 1191
Joined: Mon Jun 02, 2003 3:37 pm

Post 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
vangelis
Forum Newbie
Posts: 23
Joined: Thu Jun 05, 2003 6:35 am

Post 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!!!
User avatar
Stoker
Forum Regular
Posts: 782
Joined: Thu Jan 23, 2003 9:45 pm
Location: SWNY
Contact:

Post by Stoker »

huh?
You want all the items in a list even if they have not been selected? That doesnt make sense
m3rajk
DevNet Resident
Posts: 1191
Joined: Mon Jun 02, 2003 3:37 pm

Post 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
Post Reply