Alright, I'm fairly new to php and am not sure of the best way to do this. I've tried it by making a function, posting from the form and nothing seems to be working. I'm sure it's something basic I'm missing...I think I'm mixing my javascript and php and am confused about what I need to do here...

Anyway, I've got a calendar, which is working great so far. I'm just trying to make a simple set of buttons to increment/decrement the year variable and re-submit the form.

The year is initially set from a session variable, which is working fine. I'm thinking I should create another variable, unique to this page, that just tracks the amount that the year has been changed. I had started by setting a session variable "DeltaYear" but am not sure I should be changing the session variable on this page...doesn't seem like the right setup.

Here's the code so far, just looking for something that works for the next/previous button:


PHP Code:
<?php session_start();?>
<script>
   //I had started trying to create functions to set the variable, but couldn't figure out how to call them...
   function prevYear()
   {
      if($delta_year>0)
      {
      $delta_year-1;
      }
   }
   function nextYear()
   {
      $delta_year+1;
   }

</script>
</div>
   <div id="content">
   <div id="text" style="width:800px;">      
      <a name="calendar"></a>
      <h2>Calendar</h2>      
            <!--start calendar insert here-->
            <div align = "center">
            <form action="index3.php" method="post">            
               <input name="Year" type="hidden" id="Year" value="2012" />
               <!--I tried this with both buttons and href links, but neither worked -->
               <input name="NextYear" type="button" id="NextYear" value="Next Year" ONCLICK="nextYear" />               
               <a href='#' onclick='prevYear();'>Next Year</a><br/>            
            </form>           
            <?php
               
print "<h2>".$_SESSION["Year"]."</h2><br/>";
               include(
"includes/calendar.php");               
               
$cal = new calendar();
               if (!isset(
$year)){
                  
$year $_SESSION["Year"];
                  
$delta_year $_SESSION["DeltaYear"];
                  
$x=$cal->ShowCalendar($year+$delta_year);                  
               }
            
?>            
            </div>
            <!--end calendar insert here-->
         
   </div>
   </div>
</div>

Thanks!