I'm trying to set a date. What I want is to increment a value for Month, everytime a button in selected, in this case NEXT. When this happens the month value should be incremented by 1. If PREV is selected, the value should be decremented by 1.
The following code sets initial value to 00, when NEXT is selected, value sets to 01, however it won't increment again, regardless of how many times you select NEXT. You can select PREV to set it back to 00, but thats it.
I'm wondering why it will only increment the value once, and not everytime NEXT is selected?
echo "
<TABLE width=100%><FORM METHOD=\"POST\" ACTION=\"$_SERVER[PHP_SELF]\">
<INPUT TYPE=\"hidden\" NAME=\"show\" VALUE=\"as\">
<tr><td><div align=\"left\"><INPUT TYPE=\"Submit\" Name=\"Submit\" Value=\"PREV\"></div></td>
<td><div align=\"right\"><INPUT TYPE=\"Submit\" Name=\"Submit\" Value=\"NEXT\"></td></td></tr></TABLE>
</FORM>";
if ($POST[Submit] == "PREV")
{
$control_date--;
}
else
{
if ($POST[Submit] == "NEXT")
{
$control_date++;
}
}
$date = sprintf("%02d",$control_date);
echo "$date";