make specific value selected in dropdown fields cakephp 3.0 -


in select drop down, make 1 particular value selected values coming in drop down list cakephp3.0. using below code:

    $abc = 'india';     echo $this->form->input('location_id',  ['empty' =>'please select', 'required'=>'required', 'class' => 'form-control', 'label'=>false]); 

name of countries coming in drop down list, want make specific value selected set variable $abc (i.e india).

use value option of form input helper. :

$selected = 'india'; echo $this->form->input('location_id', ['empty' =>'please select', 'required'=>'required', 'class' => 'form-control', 'label'=>false, 'value'=> $selected]); 

suggestion - read docs once , start development. never stuck @ such simple problems. , refer docs first whenever stuck @ anything.


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -