Jump to content

Edit form using dropdown/radio button.


yash87

Recommended Posts

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

<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>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.