Toma este lo hice completo solo copia, pega y ejecuta pa que veas.. Código PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin título</title>
</head>
<body>
<?
$mes=0;
for($l=0;$l<6;$l++)
{
$mes=$mes+1;
if(($l==0)||($l==2)||($l==3)||($l==5))
{
?>
<br /><table width="300" border="1">
<td height="20" colspan="7"><div align="center">
<? if($mes==1)
{?>
Octubre 2009
<? }
else
if($mes==3)
{ ?>
Diciembre 2009<?
}
else
if($mes==4)
{?>
Enero 2010
<? }
else
if($mes==6)
{?>
Marzo 2010
<?
}?>
</div></td>
<?
$dia=0;
$pas=0;
?><tr><?
for($d=1;$d<=7;$d++)
{
?>
<td height="20"><div align="center">
<?
if($d==1)
{
echo "Lunes";
}
else
if($d==2)
{
echo "Martes";
}
else
if($d==3)
{
echo "Miercoles";
}
else
if($d==4)
{
echo "Jueves";
}
else
if($d==5)
{
echo "Viernes";
}
else
if($d==6)
{
echo "Sabado";
}
else
if($d==7)
{
echo "Domingo";
}
}
?>
</div></td></tr>
<?
for($j=0;$j<5;$j++)
{
?>
<tr>
<?
for($i=0;$i<7;$i++)
{
$pas=$pas+1;
?>
<td height="20"><div align="center">
<?
if($mes==1)
{
if($pas>3)
{
if($pas==35)
{
echo "";
}
else
{
echo $dia=$dia+1;
}
}
}
else
if($mes==3)
{
if($pas>1)
{
if(($pas==35)||($pas==34)||($pas==33))
{
echo "";
}
else
{
echo $dia=$dia+1;
}
}
}
else
if($mes==4)
{
if($pas>4)
{
echo $dia=$dia+1;
}
}
if($mes==6)
{
if(($pas==35)||($pas==34)||($pas==33)||($pas==32))
{
echo "";
}
else
{
echo $dia=$dia+1;
}
}
?>
</div></td>
<? } ?>
</tr>
<? } ?>
</table>
<?
}
else
if($l==1)
{
?>
<br /><table width="300" border="1">
<td height="20" colspan="7"><div align="center">Noviembre 2010</div></td>
<?
$dia=0;
$pas=0;
?>
<tr><?
for($d=1;$d<=7;$d++)
{
?>
<td height="20"><div align="center">
<?
if($d==1)
{
echo "Lunes";
}
else
if($d==2)
{
echo "Martes";
}
else
if($d==3)
{
echo "Miercoles";
}
else
if($d==4)
{
echo "Jueves";
}
else
if($d==5)
{
echo "Viernes";
}
else
if($d==6)
{
echo "Sabado";
}
else
if($d==7)
{
echo "Domingo";
}
}
?>
</div></td></tr>
<? for($s=0;$s<6;$s++)
{
?>
<tr>
<?
for($m=0;$m<7;$m++)
{
$pas=$pas+1
?>
<td height="20"><div align="center">
<?
if($pas>6)
{
if(($pas==37)||($pas==38)||($pas==39)||($pas==40)||($pas==41)||($pas==42))
{
echo "";
}
else
{
echo $dia=$dia+1;
}
}
?>
</div></td>
<? } ?>
</tr>
<?
}
?>
</table>
<?
}
else
if($l==4)
{?>
<br /><table width="300" border="1">
<td height="20" colspan="7"><div align="center">Febrero 2010</div></td>
<?
$dia=0;
$pas=0;
?>
<tr><?
for($d=1;$d<=7;$d++)
{
?>
<td height="20"><div align="center">
<?
if($d==1)
{
echo "Lunes";
}
else
if($d==2)
{
echo "Martes";
}
else
if($d==3)
{
echo "Miercoles";
}
else
if($d==4)
{
echo "Jueves";
}
else
if($d==5)
{
echo "Viernes";
}
else
if($d==6)
{
echo "Sabado";
}
else
if($d==7)
{
echo "Domingo";
}
}
?>
</div></td></tr>
<? for($x=0;$x<4;$x++)
{
?>
<tr>
<? for($y=0;$y<7;$y++)
{
$pas=$pas+1
?>
<td><div align="center"><? echo $dia=$dia+1; ?></div></td>
<? } ?>
</tr>
<? } ?>
</table>
<?
}
}
?>
</table>
</body>
</html>