sayedsohail Posted July 24, 2007 Share Posted July 24, 2007 Hi everone, i am just trying highlight one of title in my select list box, when $dlist['id'] = $selvalue; so far my select highlights the first option. Thanks for reading and help. $selvalue = $_GET['id']; $outdata= "<select name="titles" >"; $outdata.="<option value=''> Please choose the Title</option>"; while( $dlist = mysql_fetch_array($result) ) $outdata.="<option value='".$dlist['id']. "'> " .$dlist['serial_number']. "-" .$dlist['title']. " </option>"; $outdata.="</select>"; Quote Link to comment Share on other sites More sharing options...
soycharliente Posted July 24, 2007 Share Posted July 24, 2007 <?php $selvalue = $_GET['id']; $outdata= "<select name=\"titles\">"; $outdata.="<option value=\"\"> Please choose the Title</option>"; while( $dlist = mysql_fetch_array($result) ) { if ($dlist['id'] = $selvalue) { $outdata.="<option selected=\"selected\" value=\"".$dlist['id']. "\">".$dlist['serial_number']. "-" .$dlist['title']. " </option>"; } else { $outdata.="<option value=\"".$dlist['id']. "\">" .$dlist['serial_number']. "-" .$dlist['title']. " </option>"; } } $outdata.="</select>"; ?> Quote Link to comment Share on other sites More sharing options...
sayedsohail Posted July 24, 2007 Author Share Posted July 24, 2007 thanks a million 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.