to display calendar using javascript and php
<p>im new to this PHP im trying to develop a code such that when i click launch calendar it ll display calendar and when i choose the date it ll display in the text field but my problem is when i clik launch calendar its not showing feburay month.. i dont no wt the error in my code can anyone pls help me out in this.. thanks in advance.. here is my code what i have developed...</p>

<pre><code>&lt;?php

$day = $_GET["day"];
$month = $_GET["month"];
$year = $_GET["year"];
$sel = $_GET["sel"];
$what = $_GET["what"];
$field = $_GET["field"];
$form = $_GET["form"];

if($day == "") $day = date("j");

if($month == "") $month = date("m");

if($year == "") $year = date("Y");

$currentTimeStamp = strtotime("$year-$month-$day");
$monthName = date("F", $currentTimeStamp);
$numDays = date("t", $currentTimeStamp);
$counter = 0;
?&gt;


&lt;html&gt;
&lt;head&gt;
&lt;title&gt;MyCalendar&lt;/title&gt;
&lt;link rel="stylesheet" type="text/css" href="calendar.css"&gt;
&lt;script language="javascript"&gt;
    function goLastMonth(month,year,form,field)
    {

        if(month == 1)
    {
    --year;
    month = 13;
    }       
        document.location.href = 'calendar.php?month='+(month-1)+'&amp;year='+year+'&amp;form='+form+'&amp;field='+field;
    }

    function goNextMonth(month,year,form,field)
    {

        if(month == 12)
    {
    ++year;
    month = 0;
    }   
        document.location.href = 'calendar.php?month='+(month+1)+'&amp;year='+year+'&amp;form='+form+'&amp;field='+field;
    }

    function sendToForm(val,field,form)
    {

        eval("opener.document." + form + "." + field + ".value='" + val + "'");
        window.close();
    }
&lt;/script&gt;
&lt;/head&gt;
&lt;body style="margin:0px 0px 0px 0px" class="body"&gt;
&lt;table width='175' border='0' cellspacing='0' cellpadding='0' class="body"&gt;
    &lt;tr&gt;
        &lt;td width='25' colspan='1'&gt;
        &lt;input type='button' class='button' value=' &lt; ' onClick='&lt;?php echo "goLastMonth($month,$year,\"$form\",\"$field\")"; ?&gt;'&gt;
        &lt;/td&gt;
        &lt;td width='125' align="center" colspan='5'&gt;
        &lt;span class='title'&gt;&lt;?php echo $monthName . " " . $year; ?&gt;&lt;/span&gt;&lt;br&gt;
        &lt;/td&gt;
        &lt;td width='25' colspan='1' align='right'&gt;
        &lt;input type='button' class='button' value=' &gt; ' onClick='&lt;?php echo "goNextMonth($month,$year,\"$form\",\"$field\")"; ?&gt;'&gt;
        &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td class='head' align="center" width='25'&gt;S&lt;/td&gt;
        &lt;td class='head' align="center" width='25'&gt;M&lt;/td&gt;
        &lt;td class='head' align="center" width='25'&gt;T&lt;/td&gt;
        &lt;td class='head' align="center" width='25'&gt;W&lt;/td&gt;
        &lt;td class='head' align="center" width='25'&gt;T&lt;/td&gt;
        &lt;td class='head' align="center" width='25'&gt;F&lt;/td&gt;
        &lt;td class='head' align="center" width='25'&gt;S&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
&lt;?php
    for($i = 1; $i &lt; $numDays+1; $i++, $counter++)
    {
        $timeStamp = strtotime("$year-$month-$i");
        if($i == 1)
        {

        $firstDay = date("w", $timeStamp);

        for($j = 0; $j &lt; $firstDay; $j++, $counter++)
        echo "&lt;td&gt; &lt;/td&gt;";
        }

        if($counter % 7 == 0)
        echo "&lt;/tr&gt;&lt;tr&gt;";

        if(date("w", $timeStamp) == 0)

        $class = "class='weekend'";
        else
        if($i == date("d") &amp;&amp; $month == date("m") &amp;&amp; $year == date("Y"))
        $class = "class='today'";
        else
        $class = "class='normal'";

        echo "&lt;td class='tr' bgcolor='#ffffff' align='center' width='25'&gt;&lt;a class='buttonbar' href='#' onclick=\"sendToForm('".sprintf("%02d/%02d/%04d", $month, $i, $year)."','$field','$form');\"&gt;&lt;font $class&gt;$i&lt;/font&gt;&lt;/a&gt;&lt;/td&gt;";
    }
?&gt;
    &lt;/tr&gt;
&lt;/table&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
