CodeIgniter额外选项值

I have been pulling my hair out for god knows how long trying to work this out.

Currently I have a select list (form_dropdown) like this.

<select name="starters">
<option value="">Please Select</option>
<option value="0" >Brochettes</option>
<option value="1" >Grilled mackerel</option>
<option value="2" >Risotto cake</option>
<option value="3" >Calamari rings</option>
<option value="4">Parma ham parmesan</option>
</select> 

What I need to do Is pass into this form_dropdown is a Price Value, so I can have a dynamic price calculator on the website.

<select name="starters">
<option value="" price="100">Please Select</option>
<option value="0" price="22">Brochettes</option>
<option value="1" price="342">Grilled mackerel</option>
<option value="2" price="42">Risotto cake</option>
<option value="3" price="52">Calamari rings</option>
<option value="4" price="22">Parma ham parmesan</option>
</select> 

Is there any way I can do this? Im really stuck for dead lines and I thought this would be possible in code igniter.

My code so far, as you can see I have a price, but I need to pass it into the option.

            echo form_label("APPETISERS", "appetisers");
            $array = array();
            foreach($appertisers as $row ){
                 $array[] = $row->product;
                 $price[] = $row->price;
            }
            $array = array_merge(array('' => 'Please Select'), $array);
            echo form_dropdown('appetisers',  $array);

Well I don't know how to do that with the codeingiter form_label, mostly because I don't use the form_helper to create inputs.

Usually I do this way:

<select name="starters">
  <option value="">Please Select</option>
  <?php foreach($appertisers as $row ):?>
  <option value="<?=$row->id?>" data-price="<?=$row->price?>"><?=$row->product?></option>
  <?php endforeach;?>
</select>

I've named your price attribute to data-price, this way you can use the data function like this:

var price_value = $('select[name="starters"] option:selected').data('price');

You can read more about the data attribute here http://api.jquery.com/data/ and here http://html5doctor.com/html5-custom-data-attributes/

You can do it exactly like you showed in your example. You can use jQuery to extract the price of the selected element.

See: http://api.jquery.com/attr/