Hi ...I'm new to PHP.. I need some help to debub the below code. Actually I downloaded it my net and Here is my edited calender source code...

Calender.php


<?php
// Get values from query string
$day = isset($_GET['day'])?$_GET['day']:0; //0 is the default?
$month = isset($_GET['month'])?$_GET['month']:0;//0 is the default?
$year = isset($_GET['year'])?$_GET['year']:0;//0 is the default?

//if (isset($_GET["day"])) $day = $_GET["day"];
//if (isset($_GET["month"])) $month = $_GET["month"];
//if (isset($_GET["year"])) $year = $_GET["year"];
if (isset($_GET["sel"])) $sel = $_GET["sel"];
if (isset($_GET["what"])) $what = $_GET["what"];
if (isset($_GET["field"])) $field = $_GET["field"];
if (isset($_GET["form"])) $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;
/*$numEventsThisMonth = 0;
$hasEvent = false;
$todaysEvents = "";*/
?>
<html>
<head>
<title>MyCalendar</title>
<link rel="stylesheet" type="text/css" href="calendar.css">
<script language="javascript">
function goLastMonth(month,year,form,field)
{
// If the month is January, decrement the year.
if(month == 1)
{
--year;
month = 13;
}
document.location.href = 'calendar.php?month='+(month-1)+'&year='+year+'&form='+form+'&field='+field;
}

function goNextMonth(month,year,form,field)
{
// If the month is December, increment the year.
if(month == 12)
{
++year;
month = 0;
}
document.location.href = 'calendar.php?month='+(month+1)+'&year='+year+'&form='+form+'&field='+field;
}

function sendToForm(val,field,form)
{
// Send back the date value to the form caller.
eval("opener.document." + form + "." + field + ".value='" + val + "'");
window.close();
}
</script>
</head>
<body style="margin:0px 0px 0px 0px" class="body">
<table width='175' border='0' cellspacing='0' cellpadding='0' class="body">
<tr>
<td width='25' colspan='1'>
<input type='button' class='button' value=' < ' onClick='<?php echo "goLastMonth($month,$year,\"$form\",\"$field\")"; ?>'>
</td>
<td width='125' align="center" colspan='5'>
<span class='title'><?php echo $monthName . " " . $year; ?></span><br>
</td>
<td width='25' colspan='1' align='right'>
<input type='button' class='button' value=' > ' onClick='<?php echo "goNextMonth($month,$year,\"$form\",\"$field\")"; ?>'>
</td>
</tr>
<tr>
<td class='head' align="center" width='25'>S</td>
<td class='head' align="center" width='25'>M</td>
<td class='head' align="center" width='25'>T</td>
<td class='head' align="center" width='25'>W</td>
<td class='head' align="center" width='25'>T</td>
<td class='head' align="center" width='25'>F</td>
<td class='head' align="center" width='25'>S</td>
</tr>
<tr>
<?php
for($i = 1; $i < $numDays+1; $i++, $counter++)
{
$timeStamp = strtotime("$year-$month-$i");
if($i == 1)
{
// Workout when the first day of the month is
$firstDay = date("w", $timeStamp);

for($j = 0; $j < $firstDay; $j++, $counter++)
echo "<td> </td>";
}

if($counter % 7 == 0)
echo "</tr><tr>";

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

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

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

Add.html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>

<BODY>
<form name="frmMain" method="get" action="">
<p/>
Display Date: <input type="text" name="txtDate" value="mm/dd/yyyy" size="15" maxlength="10"> <br/>
Enter Date:<input type="text" name="day" id="day" value="" size="3" maxLength="2" />
Select Month: <select name="month" id="month">
<option value="1">January</option>
<option value="2">February</option>
<option value="3">March</option>
<option value="4">April</option>
<option value="5">May</option>
<option value="6">June</option>
<option value="7">July</option>
<option value="8">August</option>
<option value="9">September</option>
<option value="10">October</option>
<option value="11">November</option>
<option value="12">December</option>
</select>
Enter Date:<input type="text" name="year" id="year" value="" size="5" maxLength="4"/>
<input type="button" name="cmdCal" value="Launch Calendar" onClick='javascript:window.open("calendar.php?month=month&year=&form=frmMain&field=txtDate","","top= 50,left=400,width=175,height=140,menubar=no,toolbar=no,scrollbars=no,resizable=no,status=no"); return false;'> <br/>
<p/>
<input type="submit" name="submit" value="check" size="15" maxlength="10"/>
</form>
</BODY>
</HTML>