I'm trying to retain the values of the month and year after the form been sent.. Anyone know how i should do it?
User gets to select 02 for month and 2001 for year..
After it is been sent the values go back to - , what i want here is to retain the values of both month and year, 02 and 2001 that is.
$month = array (1=>"-","01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12");
$select = "<select name=\"month\">\n";
foreach ($month as $key => $val) {
$select .= "\t<option val=\"".$key."\"";
if ($key == 1){
$select .= " selected>".$val."\n";
}//end if
else{
$select .= ">".$val."\n";
}// end else
}// end foreach
$select .= "</select>";
echo $select;
// Displaying the Year in the DateOfOccurence drop down box
$year = date("Y"); //get the current year from the system
echo "<select name='year'>\n";
echo '<option value="" selected">-</option>';
for ($n=$year;$year-10<=$n;$n--) { // gets the current year and do a subtraction of 10 to display the array of descending 10 years
echo " <option value=\"$n\">$n</option>";
} // end for
echo "</select>\n";
}// end function