questo potrebbe andarti bene?
<?php
define ('ADAY', (60*60*24));
$datearray = getdate();
$annoattuale=$datearray['year'];
$mesecontrollo=$datearray['mon'];
$mese=(int)$_POST[mesecal];
$anno=(int)$_POST[annocal];
$vnews=$_GET[vnews];
if($mese>0){$month=$mese;$datearray['mon']=$month;}
if($vnews==1){$month = $_GET[vmese];$datearray['mon']=$month;}
else{$month=$datearray['mon'];}
if($anno>0){$year=$anno;$datearray['year']=$anno;}
else{$year=$datearray['year'];}
$start= mktime(0,0,0,$month,1,$year);
$firstdayarray = getdate($start);
$mon = Array('','Gen','Feb','Mar','Apr','Mag','Giu','Lug' ,'Ago','Set','Ott','Nov','Dic');
$days = Array('Do','Lu','Ma','Me','Gi','Ve','Sa');
echo"<center>
<form method='POST' action='index.php' name='calend'>
<table border=0 class='calendario'>
<tr>
<td colspan='7'>
<center>";
$inizio=$month-11;
echo"
<select size='1' class='inform' name='mesecal' onchange='document.calend.submit()'>
<option value=1";if($month==1){echo" selected";}echo">$mon[1]</option>
<option value=2";if($month==2){echo" selected";}echo">$mon[2]</option>
<option value=3";if($month==3){echo" selected";}echo">$mon[3]</option>
<option value=4";if($month==4){echo" selected";}echo">$mon[4]</option>
<option value=5";if($month==5){echo" selected";}echo">$mon[5]</option>
<option value=6";if($month==6){echo" selected";}echo">$mon[6]</option>
<option value=7";if($month==7){echo" selected";}echo">$mon[7]</option>
<option value=8";if($month==8){echo" selected";}echo">$mon[8]</option>
<option value=9";if($month==9){echo" selected";}echo">$mon[9]</option>
<option value=10";if($month==10){echo" selected";}echo">$mon[10]</option>
<option value=11";if($month==11){echo" selected";}echo">$mon[11]</option>
<option value=12";if($month==12){echo" selected";}echo">$mon[12]</option>
</select>
<select size='1' class='inform' name='annocal' onchange='document.calend.submit()'>
<option value=$annoattuale>$annoattuale</option>
";$yea=$annoattuale-1;echo"<option value=$yea";if($yea==$datearray['year']){echo" selected";}echo">$yea</option>
";$yea=$annoattuale-2;echo"<option value=$yea";if($yea==$datearray['year']){echo" selected";}echo">$yea</option>
";$yea=$annoattuale-3;echo"<option value=$yea";if($yea==$datearray['year']){echo" selected";}echo">$yea</option>
";$yea=$annoattuale-4;echo"<option value=$yea";if($yea==$datearray['year']){echo" selected";}echo">$yea</option>
</select>
</td>
</tr>
<tr>";
foreach($days as $day)
{echo"
<td>$day</div></td>";
}
for( $count=0;$count<(6*7);$count++)
{
$dayarray = getdate($start);
if((($count) % 7) == 0)
{
if($dayarray['mon'] != $datearray['mon'])
break;
echo "</tr><tr>";
}
if($count < $firstdayarray['wday'] || $dayarray['mon'] != $month)
{
echo "<td>
</td>";
}
else
{
if($dayarray['mday'] == $datearray['mday'])
{if($month==$mesecontrollo){
echo"<td>";}
else{echo"<td>";}
$month1=$month;
if($month1<10){$month1="0".$month;}
$richiamodata=$dayarray[mday]."".$month1."".$year;
$query="select * from tabella_news where richiamodata=$richiamodata";
$ris=mysql_query($query,$conn) or die ("errore query4");
$riga=mysql_fetch_array($ris);
if($riga[richiamodata]>0){
echo"
<a href=index.php?cella=news/richiamonews.php&data=$richiamodata&vnews=1&vmese= $month>$dayarray[mday]</a>";}
else{echo"$dayarray[mday]";}
?>
</td>
<?php
$start += ADAY;
}
else
{
echo"<td>";
$month1=$month;
if($month1<10){$month1="0".$month;}
$richiamodata=$dayarray[mday]."".$month1."".$year;
$query="select * from tabella_news where richiamodata=$richiamodata";
$ris=mysql_query($query,$conn) or die ("errore query5");
$riga=mysql_fetch_array($ris);
if($riga[richiamodata]>0){echo"<a href=index.php?cella=news/richiamonews.php&data=$richiamodata&vnews=1&vmese= $month>$dayarray[mday]</a>";}
else{echo"$dayarray[mday]";}
?>
</td>
<?php
$start += ADAY;
}
}
}
?>
</tr>
</table>
</form>
visibile su www.comonight.com

Rispondi quotando