eva21 Posted May 14, 2009 Share Posted May 14, 2009 In my php: echo("<Select size=3 MULTIPLE onchange='getBlendMedia(" . $rows['id'] . ")' name='" . $rows['id'] . "_teach[]' id='" . $rows['id'] . "_teach'>"); echo("<option value='t1' " . selectMatch("t1",$teach_list[0]) . " >Simple </option>"); selectMatch is a php function that returns "SELECTED"....but i have like 3 options but only one of them is selected. Why arent the other ones being selected? Quote Link to comment Share on other sites More sharing options...
ohdang888 Posted May 14, 2009 Share Posted May 14, 2009 only 1 option can be selected from each <select> tag Quote Link to comment Share on other sites More sharing options...
eva21 Posted May 14, 2009 Author Share Posted May 14, 2009 Why can i select more than one than? I must be able to select more than one using php Quote Link to comment Share on other sites More sharing options...
ohdang888 Posted May 14, 2009 Share Posted May 14, 2009 Nope, its not possible. If you have ONE select tag, that input can only have ONLY value defined in it.... If you say 2 are selected, then it will just display the top one, depending on your browser Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 14, 2009 Share Posted May 14, 2009 eva21, don't pay attention to ohdang88. From the code you posted, I can't determine if you're writing it correctly. If you view source it, do you see the options you want selected have the selected attribute in them? Or post some more code. It would help if you post the selectMatch() function as well. Thanks! Quote Link to comment Share on other sites More sharing options...
ohdang888 Posted May 15, 2009 Share Posted May 15, 2009 eva21, don't pay attention to ohdang88. From the code you posted, I can't determine if you're writing it correctly. If you view source it, do you see the options you want selected have the selected attribute in them? Or post some more code. It would help if you post the selectMatch() function as well. Thanks! maybe i'm misunderstanding him...but when you have a <select> tag, you can't select more than one value correct? Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 15, 2009 Share Posted May 15, 2009 Read it and weep. http://www.w3schools.com/TAGS/att_select_multiple.asp Quote Link to comment Share on other sites More sharing options...
timmah1 Posted May 15, 2009 Share Posted May 15, 2009 ohdang888 AND Ken2k7, your both right. With the standard <select> tag like eva21 is doing, you cannot select more than one, so ohdang888 is right. With a <select multiple="multiple"> tag, you can select more than one, so Ken2k7 is right. So to answer ea21's original question <?php echo("<select size='3' multiple='multiple' onchange='getBlendMedia(" . $rows['id'] . ")' name='" . $rows['id'] . "_teach[]' id='" . $rows['id'] . "_teach'>"); echo("<option value='t1' " . selectMatch("t1",$teach_list[0]) . " >Simple </option>"); ?> Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 15, 2009 Share Posted May 15, 2009 I never said ohdang888 is wrong. But it would have helped if ohdang888 looked at eva21's code to realize the select had the multiple attribute, even if her HTML is not valid xHTML. It could be that ohdang888 is unaware of select's multiple attribute. Quote Link to comment Share on other sites More sharing options...
ohdang888 Posted May 15, 2009 Share Posted May 15, 2009 It could be that ohdang888 is unaware of select's multiple attribute. That's exactly it. Never used them before. There's better ways to say that other than "Don't listen to ohdang888". Just pointing that out. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.