suma237 Posted February 11, 2008 Share Posted February 11, 2008 check the below code...Problem is that I'm unable to display 2 value's selected in the drop down.The drop down will showing only last id from the variable ($REPORTTO= "0003,0004".why?how can i solve this? <code> <? $REPORTTO = "0003,0004"; //echo "Reported To<br>".$REPORTTO;echo "<br>"; $sql_repto = "SELECT a.AtxUserID,a.AtxUserName FROM uniuserprofile a,unigroupdetails b WHERE a.AtxUserID = b.ugdContactID "; $result1 = mysql_query($sql_repto) or die("Could not select"); echo " <select name='reportto[]' multiple>"; echo" <option value='0'>Please Select</option>"; while($row=mysql_fetch_array($result1)) { $AtxUID = $row['AtxUserID']; $AtxUName = $row['AtxUserName']; $arraybreak = explode(",", $REPORTTO); $arrayLength= count($arraybreak); for($p=0; $p <= $arrayLength-1; $p++) { if ($AtxUID == $arraybreak[$p]) { // set the variable $selected to selected if records match $strSelected ="selected"; } else { // leave it blank if records not found $strSelected=""; } } //end of for echo "<OPTION VALUE=".$AtxUID ." $strSelected> ".$AtxUName."</OPTION>"; }//end of while echo"</select>"; ?> </code> Link to comment https://forums.phpfreaks.com/topic/90470-multiple-selection-box/ Share on other sites More sharing options...
suma237 Posted February 11, 2008 Author Share Posted February 11, 2008 problem solved... Link to comment https://forums.phpfreaks.com/topic/90470-multiple-selection-box/#findComment-463868 Share on other sites More sharing options...
Julian Posted August 6, 2009 Share Posted August 6, 2009 Hello! Sorry for open this post. But I have the same situation. only the last record is selected. Does anyboby know how to solve it? Regards Link to comment https://forums.phpfreaks.com/topic/90470-multiple-selection-box/#findComment-892485 Share on other sites More sharing options...
Julian Posted August 6, 2009 Share Posted August 6, 2009 This is driving me nuts... any hint... please Link to comment https://forums.phpfreaks.com/topic/90470-multiple-selection-box/#findComment-892559 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.