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> Link to comment https://forums.phpfreaks.com/topic/216214-edit-form-using-dropdownradio-button/ 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> Link to comment https://forums.phpfreaks.com/topic/216214-edit-form-using-dropdownradio-button/#findComment-1123686 Share on other sites More sharing options...
yash87 Posted October 19, 2010 Author Share Posted October 19, 2010 Thank u. Link to comment https://forums.phpfreaks.com/topic/216214-edit-form-using-dropdownradio-button/#findComment-1123688 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.