<?php

function gen_month_dd($month) {
	$cal = cal_info(0);
	foreach($cal['months'] as $k => $v) {
		$month == $k ? $sel = 'selected' : $sel = '';
		$output .= "<option value='$k' $sel>$v</option>";
	}
	return $output;
}

function gen_year_dd($year,$prev_years = 0) {
	$start_year = date('Y') - $prev_years;
	for($i = $start_year; $i <= $start_year+$prev_years ; $i++) {
		$year == $i ? $sel = 'selected' : $sel = '';
		$output .= "<option value='$i' $sel>$i</option>";
	}
	return $output;
}

?>