I am wanting to create three select boxes for a user’s date of birth in a CakePHP app.
How do I do this? I have managed to build a Male or Female one using:
<?php echo $this->Form->input('gender', array('label' => '<strong>Gender</strong>', 'type' => 'select',
'options' => array('Male'=>'Male','Female'=>'Female'))); ?>
But for a DoB one I’d need to pre-populate the fields with the month, days and year.
Can anyone help? Thanks
all you need is a DB field called “birthday” or whatever which is of type “date”.
thats it
i recommend adding empty=>’- -‘ to the options array, though.
I also use min and max for years which is quite helpful:
whereas those two constants are defined in my bootstrap. you could also use Configure::write() and read() for it. max is in my case 99 and min 9
for a “german” form it would then be