Dennis_gull Posted February 12, 2007 Share Posted February 12, 2007 Hey, I use a dropdown menu for dob but I would like it to set the latest year (now) first and not the other way around but I cant seem to get it to work. This is how the code looks like now: $today = getdate(); $first_year = $today['year'] - 77; $last_year = $today['year'] - 14; for ($i=$first_year; $i < $last_year; $i++) { $dob_year_arr[] = array('id' => sprintf('%02d', $i), 'text' => sprintf('%02d', $i)); } (thats the year part of the code) I wish I could just change the < to > but it doesnt allow me too :angry: Link to comment Share on other sites More sharing options...
insomniac2 Posted February 13, 2007 Share Posted February 13, 2007 May I ask why you would do it that way? ... because most people are not going to have been born in 2007. The box defaults to the oldest date for the reason that most dob choices will be back 18 to 40 yrs or more. Link to comment Share on other sites More sharing options...
Dennis_gull Posted February 13, 2007 Author Share Posted February 13, 2007 Yeah but Im not going to let it start at 2007. Wouldnt you think its easier to start from 1990 rather then 1930? :) Link to comment Share on other sites More sharing options...
insomniac2 Posted February 14, 2007 Share Posted February 14, 2007 Yes I guess that would be cool. I will have to look into this and see if I can figure it out. Link to comment Share on other sites More sharing options...
Dennis_gull Posted February 15, 2007 Author Share Posted February 15, 2007 Does anyone else know how to fix this? Link to comment Share on other sites More sharing options...
WiredOnSite Posted August 28, 2007 Share Posted August 28, 2007 if (ACCOUNT_DOB == 'true') { ?> <tr> <td class="main"><?php echo ENTRY_DATE_OF_BIRTH; ?></td> <td class="main"><?php $months = array(array('id' => '01', 'text' => MONTH_JANUARY), array('id' => '02', 'text' => MONTH_FEBRUARY), array('id' => '03', 'text' => MONTH_MARCH), array('id' => '04', 'text' => MONTH_APRIL), array('id' => '05', 'text' => MONTH_MAY), array('id' => '06', 'text' => MONTH_JUNE), array('id' => '07', 'text' => MONTH_JULY), array('id' => '08', 'text' => MONTH_AUGUST), array('id' => '09', 'text' => MONTH_SEPTEMBER), array('id' => '10', 'text' => MONTH_OCTOBER), array('id' => '11', 'text' => MONTH_NOVEMBER), array('id' => '12', 'text' => MONTH_DECEMBER)); $days = array(array('id' => '01', 'text' => '1'),array('id' => '02', 'text' => '2'), array('id' => '03', 'text' => '3'), array('id' => '04', 'text' => '4'), array('id' => '05', 'text' => '5'), array('id' => '06', 'text' => '6'), array('id' => '07', 'text' => '7'), array('id' => '08', 'text' => '8'), array('id' => '09', 'text' => '9'), array('id' => '10' , 'text' => '10'), array('id' => '11', 'text' => '11'), array('id' => '12', 'text' => '12'), array('id' => '13', 'text' => '13'), array('id' => '14', 'text' => '14'), array('id' => '15', 'text' => '15'), array('id' => '16', 'text' => '16'), array('id' => '17', 'text' => '17'), array('id' => '18', 'text' => '18'), array('id' => '19', 'text' => '19'), array('id' => '20', 'text' => '20'), array('id' => '21', 'text' => '21'), array('id' => '22', 'text' => '22'), array('id' => '23', 'text' => '23'), array('id' => '24', 'text' => '24'), array('id' => '25', 'text' => '25'), array('id' => '26', 'text' => '26'), array('id' => '27', 'text' => '27'), array('id' => '28', 'text' => '28'), array('id' => '29', 'text' => '29'), array('id' => '30', 'text' => '30'), array('id' => '31', 'text' => '31')); /*This Will Make the Years Descend (To disable this and enable the other erase the following end statement */ for ($i=date("Y"); $i>=1920; $i--) { $years[] = array('id' => $i, 'text' => $i); } /*This will Make the Years Descend*/ /*This will Make the Years Ascend (To enable this add an end statement like this */ /*at the end of this line for($i=1920; $i<date('Y')-10; $i++) { $years[] = array('id' => $i, 'text' => $i); } /*This will Make the Years Ascend*/ echo tep_draw_pull_down_menu('dob_month', $months); echo tep_draw_pull_down_menu('dob_day', $days); echo tep_draw_pull_down_menu('dob_year', $years); echo ' ' . (tep_not_null(ENTRY_DATE_OF_BIRTH_TEXT) ? '<span class="inputRequirement">' . ENTRY_DATE_OF_BIRTH_TEXT . '</span>': ''); ?></td> </tr> Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.