Hi all
I need one help i want to display monthly days for selected month and year i have written following code it is not working please correct my code
<?php
$monthNames = Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
$pmonth = (isset($_POST['cbo_month'])) ? $_POST['cbo_month'] : date('m');
if (!isset($_REQUEST["month"])) $_REQUEST["month"] = date("n");
if (!isset($_REQUEST["year"])) $_REQUEST["year"] = date("Y");
$cMonth = $_REQUEST["month"];
$cYear = $_REQUEST["year"];
?>
<form>
<table border="0" cellpadding="0" cellspacing="0"><tr>
<td><select name="cbo_month" id="cbo_month" onChange="form.submit();">
<?php
foreach($monthNames as $mno => $month)
{
$sel=($pmonth==$month) ? ' selected=selected' : '';
echo "<option value='$month'$sel>".$month."</option>";
}
?>
</select></td><td><input type="text" name="txt_yr" value="<?php echo $cYear; ?>"></td></tr>
<?php
$timestamp = mktime(0,0,0,$cMonth,1,$cYear);
$maxday = date("t",$timestamp);
$thismonth = getdate ($timestamp);
$startday = $thismonth['wday'];
echo "<tr>";
for ($i=0; $i<($maxday+$startday); $i++) {
//if(($i % 7) == 0 ) echo "<tr>\n";
if($i < $startday) echo "<td></td>";
else echo "<td align='center' valign='middle' height='20px'>". ($i - $startday + 1) . "</td>";
echo "<td> </td>";
}
//echo $cYear;
echo "</tr>";
?></table></form>
thanks in advance