Converting dropdown menu to radio buttons

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
thinkingforward
Forum Newbie
Posts: 5
Joined: Fri Oct 09, 2009 5:11 pm

Converting dropdown menu to radio buttons

Post by thinkingforward »

Hi,

I am setting up a shop with the software Opencart and have copied the following code lines which currently generate a drop down menu of prices called from the database:

Code: Select all

                <table style="width: 100%;">
                  <?php foreach ($options as $option) { ?>
                  <tr>
                    <td><?php echo $option['name']; ?>:<br />
                      <select name="option[<?php echo $option['option_id']; ?>]">
                        <?php foreach ($option['option_value'] as $option_value) { ?>
                        <option value="<?php echo $option_value['option_value_id']; ?>"><?php echo $option_value['name']; ?>
                        <?php if ($option_value['price']) { ?>
                        <?php echo $option_value['prefix']; ?><?php echo $option_value['price']; ?>
                        <?php } ?>
                        </option>
                        <?php } ?>
                      </select></td>
                  </tr>
                  <?php } ?>
                </table>
However I am trying to change them to radio buttons and wondered if anyone out there could give me some help? I've been trying to adapt the below but no joy.

Code: Select all

<input type="radio" name="blah" value="x" checked="checked"/>Option1
Thank you!
Post Reply