Can't Get a Variable to Increment after a Post This is my first post ever on a PHP forum. It's great to feel like there might be some help for my fried brain.
I am working on a site that includes a weekly calendar that will be connected to a database. The script I've written includes a function so that when the weekly calendar loads, it always starts with the last Monday. This is working.
I wrote the script also intending that the visitor can scroll forward or back to another week. This is done by means of a variable called "$scroll". If $scroll = 2, for example, the week that that is displayed is 2 weeks in the future. This is working, too.
I know it sounds dumb, but I can't get the value of $scroll to increment after the visitor slects from a menu how many weeks they want to scroll ahead and then hits the submit button. The value of $scroll goes to whatever is selected, but it never increments. It's like it gets reset to 0 each time there is a post.
I think these are the relevant parts of my code:
$increment=$_POST['increment'];
$scroll=$scroll+$increment;
(code displaying the calendar table...)
<form action="reservations.php" method=post>
Scroll Forward by
<select name="increment">
<option value="1">1 Week</option>
<option value="2">2 Weeks</option>
<option value="3">3 Weeks</option>
<option value="4">4 Weeks</option>
</select>
<input type="submit" name="scroll_forward" value="Go">
</form>
I hope I've explained enough for someone to help.
Many thanks in advance. |