In my previous post I uploaded a source code called “Populate Dropdown List Using CodeIgniter”. In that sample code, I used the country field to populate the value using the helper function.
This time, I’ll show you on how to populate a birth date field with three separate dropdown list.
Here’s the code to call the helper and populate the array with values from our function:
- $this->data['birth_date_year'] = buildYearDropdown('birth_date_year', $this->input->post('birth_date_year'));
- $this->data['birth_date_month'] = buildMonthDropdown('birth_date_month', $this->input->post('birth_date_month'));
- $this->data['birth_date_day'] = buildDayDropdown('birth_date_day', $this->input->post('birth_date_day'));
And this is how you pass the value from the controller to the view:
- echo $birth_date_day;
- echo $birth_date_month;
- echo $birth_date_year;
Please see attached file.
To download the framework please visit Getting Started With CodeIgniter.
Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.
Virus note: All files are scanned once-a-day by SourceCodester.com for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.
FOR YOUR OWN SAFETY, PLEASE:
1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.