i am creating a calender prog, using cakephp when calling a method disp with month and year as params, it should disp the calender..
this my index.ctp//$month int 1 to 12 //$mon[12]=='December'
<?php echo $form->create('Calendar', array('action' => 'disp', 'class' => 'normal')); ?>
<?php
echo $form->input('month', array('options' => $mon, 'empty'=>$mon[$month]));
echo $form->input('year', array('options' => $yr, 'empty' => $year));
?>
<?php echo $form->end('Submit'); ?>
month contains jan to dec and years 1990 to 2010
this is disp method
function disp()
{
$month= $this->data['Calendar']['month'];
$year= $this->data['Calendar']['year'];
$this->redirect(array('controller' => 'calendars', 'action' => 'index',$month,$year));
}
when calling function it displays the calender perfectly
my prob is the loaded month should select in drop down list
by default it shows the first value
i used 'empty'=>$mon[$month]
this disp the month but duplicate..
what to do to select the month in the list, which was displaying at current??