Welcome to the Cookbook

loading...

7.3.3.13 $options[‘selected’]

Used in combination with a select-type input (i.e. For types select, date, time, datetime). Set ‘selected’ to the value of the item you wish to be selected by default when the input is rendered.

echo $form->input('close_time', array('type' => 'time', 'selected' => '13:30:00'));
  1. echo $form->input('close_time', array('type' => 'time', 'selected' => '13:30:00'));

The selected key for date and datetime inputs may also be a UNIX timestamp.