1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| <?php
// define array
$montharray = array('', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
function years($selected=''){
$yearslist = "<select size='1' name='year'>";
for ( $y=1970; $y <2022; $y++ ){
if($selected == $y) $yearslist .= "<option selected value='$y'>$y</option>";
else $yearslist .= "<option value='$y'>$y</option>";
}
$yearslist .= "</select>";
return $yearslist;
}
function months($selected='',$montharray){
$monthslist = "<select size='1' name='month'>";
for ( $m=1; $m <13; $m++ ){
if($selected == $m) $monthslist .= "<option selected value='$m'>$montharray[$i]</option>";
else $monthslist .= "<option value='$m'>$montharray[$i]</option>";
}
$monthslist .= "</select>";
return $monthslist;
}
funcion printout(){
$output ='<div id="select_date">';
$output .='<form name="selectmonthyear" action=""/>';
$output .= months(date('n'));
$output .= years(date('Y'));
$output .='<input type="submit" onSubmit="loadCalendar(\"this.month.value\",\"this.year.value\");return false;" value="Go"/>';
$output .='</form></div>';
}
printout();
?> |
Partager