[eluser]TheFuzzy0ne[/eluser]
[quote author="elmbrent" date="1363624993"]How could I combine both arrays then? [/quote]
You could use the ID of the item as your <option> value. Then you can get the ID of the selected item, and grab the price from the JSON array.
[quote author="elmbrent" date="1363624993"]So it would show ( Product Name - Price )
Code:
echo form_label("APPETISERS", "appetisers");
$array = array();
foreach($appertisers as $row ){
$array[] = $row->product;
$array[] = $row->price;
}
$array = array_merge(array('' => 'Please Select'), $array);
echo form_dropdown('appetisers', $array);
[/quote]
I was thinking something more along the lines of:
Code:
$opts = array('' => 'Please Select');
foreach($appertisers as $row ){
// The format can be changed as appropriate.
$opts[$row->id] = $row->product.' ('.$row->price.')';
}
echo form_dropdown('appetisers', $opts);
[quote author="elmbrent" date="1363624993"]
I could then use RegEx to pull out the price by taking the last numbers of the selected value.
[/quote]
Indeed.