|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
||||
|
||||
|
Forms... <Select multiple="multiple">
Sorry for the bad topic-line.... but its the best desc i could think...
The form contains this: PHP Code:
I made a quick script to show the POST variables... PHP Code:
the POST variable shows the last selected item... for example, if i select all three, it returns "Rock"... Any idea how i can retreive all selected items? |
|
#2
|
|||
|
|||
|
hmm,...maybe try something like this...
Code:
<select name="genre[]" size="5" multiple="multiple" id="genre"> you may be setting the value for genre to the last selected entry. by setting it as an array it should allow you to select and display multiple. give it a shot.
__________________
-- Jason |
|
#3
|
|||
|
|||
|
Following may give you a clue to your problem:
Cut and past following code to notepad and save as t1.php And play with it. Thanks. <html> <body> <?php if (!$_POST['qry']) { ?> <form method=post action=t1.php> <select MULTIPLE NAME="class[]"> <option>[New Genre]</option> <option>Industrial</option> <option>Rock</option> </select> <input type=submit name="qry"> <?PHP } else { $class=$_POST["class"]; echo $class[0]."<br>".$class[1]."<br>".$class[2]; } ?> </form> </body></html> |
|
#4
|
||||
|
||||
|
Thanks all...
i'll play around with it, I didn't realize you could put square brackets in the name attribute... |
|
#5
|
|||
|
|||
|
Heres a little tip:
You have the following code to go though your post array PHP Code:
an easier way is to use the print_r() function PHP Code:
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > Forms... <Select multiple="multiple"> |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|