help, php calendar links

Posted by Ray on Stack Overflow See other posts from Stack Overflow or by Ray
Published on 2010-03-29T02:09:29Z Indexed on 2010/03/29 2:13 UTC
Read the original article Hit count: 381

Filed under:
|

Below is a partial table row that will create a line row of 3 columns. Two columns in each side is links, left is previous year and right is next year links. Center is links for january thru december.

When you click a month links, the calendar will show that month you've clicked in the current year the calendar is on. For example, the calendar will open current month and year by default...March 2010. If you clicked previous year (2009), it will display current month (March) of last year (2009)...and then if you click Jun, the calendar will display June of whatever the year the calendar is currently on, which is June of 2009.

my question is, what can i do to following code to do such thing.

$Calendar.= "</tr><tr><td>"."<a "."href=\"".$_SERVER["PHP_SELF"]."?year=" . $LastYear["year"] ."\"> $LastY </a></td>\n";
$Calendar.= "<td colspan=\"5\">"."<a "."href=\"".$_SERVER["PHP_SELF"]."?year=".$ThisYear["year"]."&month=" . $MonthArray[0] ."\">Jan.</a> | 
                               "."<a "."href=\"".$_SERVER["PHP_SELF"]."?year=".$ThisYear["year"]."&month=" . $MonthArray[1] ."\">Feb.</a> | 
                               "."<a "."href=\"".$_SERVER["PHP_SELF"]."?year=".$ThisYear["year"]."&month=" . $MonthArray[2] ."\">Mar.</a> | 
                               "."<a "."href=\"".$_SERVER["PHP_SELF"]."?year=".$ThisYear["year"]."&month=" . $MonthArray[3] ."\">Apr.</a> | 
                               "."<a "."href=\"".$_SERVER["PHP_SELF"]."?year=".$ThisYear["year"]."&month=" . $MonthArray[4] ."\">May</a> | 
                               "."<a "."href=\"".$_SERVER["PHP_SELF"]."?year=".$ThisYear["year"]."&month=" . $MonthArray[5] ."\">Jun.</a> | 
                               "."<a "."href=\"".$_SERVER["PHP_SELF"]."?year=".$ThisYear["year"]."&month=" . $MonthArray[6] ."\">Jul.</a> | 
                               "."<a "."href=\"".$_SERVER["PHP_SELF"]."?year=".$ThisYear["year"]."&month=" . $MonthArray[7] ."\">Aug.</a> | 
                               "."<a "."href=\"".$_SERVER["PHP_SELF"]."?year=".$ThisYear["year"]."&month=" . $MonthArray[8] ."\">Sep.</a> | 
                               "."<a "."href=\"".$_SERVER["PHP_SELF"]."?year=".$ThisYear["year"]."&month=" . $MonthArray[9] ."\">Oct.</a> | 
                               "."<a "."href=\"".$_SERVER["PHP_SELF"]."?year=".$ThisYear["year"]."&month=" . $MonthArray[10] ."\">Nov.</a> | 
                               "."<a "."href=\"".$_SERVER["PHP_SELF"]."?year=".$ThisYear["year"]."&month=" . $MonthArray[11] ."\">Dec.</a>
              </td>";
$Calendar.= "<td>"."<a "."href=\"".$_SERVER["PHP_SELF"]."?year=" . $NextYear["year"] ."\"> $NextY </a></td>\n";

Thanks in advance.

© Stack Overflow or respective owner

Related posts about php

Related posts about calendar