yash87 Posted October 19, 2010 Share Posted October 19, 2010 hi, I would like to know how do i modify this code if i Have more than 1 option in my dropdown list. Can someone help..Thankz <select name="mediaList" id="mediaList"> <option <?php echo ($rows['media_type'] =='Physical Only')?'selected="Selected"':'';?> >Physical Only</option> </select> Quote Link to comment Share on other sites More sharing options...
marcus Posted October 19, 2010 Share Posted October 19, 2010 <select name="mediaList" id="mediaList"> <?php $options = array('Physical Only', 'Checkup Only', 'Both'); foreach($options AS $option){ $selected = ($option == $rows['media_type']) ? ' SELECTED' : ''; echo '<option'.$selected.'>'.$option.'</option>' . "\n"; } ?> </select> Quote Link to comment Share on other sites More sharing options...
yash87 Posted October 19, 2010 Author Share Posted October 19, 2010 Thank u. 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.