I am using the form helper from codeigniter to create a dropdown menu. I have looked at http://codeigniter.com/user_guide/helpers/form_helper.html but it doesn't specify how to assign attributes to drop-down menu items. I want to the disabled option to the first one.
As it stands now im using:
$countries = array(
'CA' => 'Canada',
'MX' => 'Mexico',
'US' => 'United States'
<?php echo form_dropdown('country',$countries,$user->CountryCode,'class="form-control"'); ?>
CodeIgniter doesn't actually support that via the form helper. Personally I'd just hardcode the form if I needed this kind of thing.
There is however a small hack / bug that exists that you can use to get what you want. Try this for your countries array:
$countries = array( '--" disabled="disabled' => '** Please select a country **', 'CA' => 'Canada', 'MX' => 'Mexico', 'US' => 'United States' );
Then feed the array to the form helper as you have already done and see if that works.