Online Forum To Support Coders With Technical Assistance - Read Write Execute

How to set option selected for select box in cakephp ?

Ankit Agrawal
Ankit Agrawal
Published on August 20, 2015 · 1 min read

there is an attribute “selected” in cakephp for set selected value

<?php echo $this->Form->input('field_name', array(			
			'empty' => 'Default Title',
			'options' => $aOptions,
			'label' => 'Label',
			'selected' => $selected_id; 
?>
Was this article helpful?
Ankit Agrawal

Ankit Agrawal

Author & Senior Engineer at CodeExecute

Writing practical engineering guides, debugging real-world bottlenecks, and creating free tools for developer productivity.

← Previous Article How to set blank option for select box in cakephp ? Next Article → How to get geolocation data from postal code