Questo è un calendario in php completo. Sarebbe da inserire nelle pillole visto che è più unico che raro. Serve per inserire in un campo la data tramite un banalissimo pulsantino o link che apre un pop.

L'unica cosa che non riesco a modificare è il giorno nel formato gg. Ho guardato ovunque e non riesco a risolvere il problema penso risieda in queste due funzioni.
$first_day = mktime(0,0,0,$mon,1,$year);
$start_day = date("w",$first_day);
Non riesco a metterle con la doppia.
Se qualcuno vuole darme un'occhiata. la data viene inserita nel formato g/mm/aaaa. Sarebbe utile inserirla in gg/mm/aaaa.
Ringrazio 13manuel84 che mi ha passato quasi tutto il codice. Poi l'ho sistemato un pochino.

codice:
<script language="Javascript"> 
function Selezionato(w_data) 
{ 
window.opener.document.form1.data.value = w_data; 
setTimeout('window.close()',100); 
} 
</script>
Codice PHP:
function print_HTML_header()
{
    global 
$flag;
    
/*    echo "Mese: ".$_GET['month'];    
    echo "
Anno: ".$_GET['year'];    */
    
$flag = (isset($_GET['month']) && ($_GET['month'] <> date("m") || $_GET['year'] <> date("Y"))) ? 0;
    
    echo     
"<HTML>\n<HEAD>\n<STYLE>\n".
             
"\n</STYLE>".
             
"<TITLE>Calendario\n</TITLE>\n</HEAD>\n<BODY BACKGROUND='images/bg.gif'>\n\n".
             
"<P ALIGN='center' CLASS='content'>Seleziona la data in cui pubblicare la news:</P>";
}
    

//----------------- Funzione per la chiusura dei tag HTML -----------------//

function  print_HTML_footer()
{
    echo 
"</BODY></HTML>";
}

//----------------- Funzione che stampa il calendario -----------------//

function  print_calendar($mon,$year)
    {
        global 
$dates$first_day$start_day$flag;
        
        
$first_day mktime(0,0,0,$mon,1,$year);
        
$start_day date("w",$first_day);
        
$res getdate($first_day);
        
$month_name $res["month"];
        
$no_days_in_month date("t"$first_day);    // t -> numero dei giorno del mese
        
        //Controllo se il primo giorno del mese è una Domenica altrimenti riempio di spazi fino ad arrivare al primo giorno
        
for ($i 1$i <= $start_day;$i++)
            
$dates[1][$i] = " ";

        
$row 1;
        
$col $start_day 1;
        
$num 1;    //contatore dei giorni del mese
        
while($num <= 31){
            if (
$num $no_days_in_month)    break;    //se non ci sono più giorni nel mese esco da ciclo
            
else{
                
$dates[$row][$col] = $num;
                if ((
$col 1) > 7){    //se sono arrivato alla fine della settimana devo scendere di una riga
                    
$row += 1;
                    
$col 1;
                }else
                    
$col += 1;
                
$num += 1
            }
//fine if-else
        
}//fine while

        
$mon_num date("m",$first_day);    //calcolo del numero del mese -> n = senza eventuali 0
        
$temp_yr $next_yr $prev_yr $year;    //imposto l'anno di visualizzazione

        
$prev $mon_num 1;
        
$next $mon_num 1;

        
//Se Gennaio è il mese corrente imposto il mese precedente a Dicembre dell'anno precedente
        
if ($mon_num == 1){
            
$prev_yr $year 1;
            
$prev 12;
        }
    
        
//Se il dicembre è il mese corrente imposto il mese successivo a Gennaio dell'anno successivo
        
if ($mon_num == 12){
            
$next_yr $year 1;
            
$next 1;
        }

        echo 
"<DIV ALIGN='center'><TABLE BORDER=0 WIDTH=350 CELLSPACING=0";


        
//trasformo i mesi dal formato standard a quello italiano        
        
if (date("F"$first_day) == 'January')            {    $mese 'Gennaio';        $n '01';    }
        elseif (
date("F"$first_day) == 'February')    {    $mese 'Febbraio';        $n '02';    }
        elseif (
date("F"$first_day) == 'March')        {    $mese 'Marzo';        $n '03';    }
        elseif (
date("F"$first_day) == 'April')        {    $mese 'Aprile';        $n '04';    }
        elseif (
date("F"$first_day) == 'May')            {    $mese 'Maggio';        $n '05';    }
        elseif (
date("F"$first_day) == 'June')        {    $mese 'Giugno';        $n '06';    }
        elseif (
date("F"$first_day) == 'July')        {    $mese 'Luglio';        $n '07';    }
        elseif (
date("F"$first_day) == 'August')        {    $mese 'Agosto';        $n '08';    }
        elseif (
date("F"$first_day) == 'September')    {    $mese 'Settembre';    $n '09';    }
        elseif (
date("F"$first_day) == 'October')        {    $mese 'Ottobre';        $n '10';    }
        elseif (
date("F"$first_day) == 'November')    {    $mese 'Novembre';        $n '11';    }
        elseif (
date("F"$first_day) == 'December')    {    $mese 'Dicembre';        $n '12';    }

        
//imposto le variabili per navigare negli anni
        
$anno_dopo $year 1;
        
$anno_prima $year 1;
        
        
//ricevo da GET la variabile contenente il mese in visualizzazione
        
$month $_GET['month'];
        if (
$month == ''){    $month date("m");    }
        
        echo     
"\n<TR ALIGN='center'><TD BGCOLOR='#4682B4' ALIGN='left' CLASS='titoli'> ".
             
"[url='phpcalendar.php?month=$prev&year=$prev_yr']<img src=\"images/prev_month.gif\" border=0 title=\"Mese precedente\">[/url] </TD>".
             
"<TD COLSPAN=5 BGCOLOR='#4682B4' ALIGN='center' CLASS='corrente'>[B]".$mese." ".$temp_yr."[/B]</TD>".
             
"<TD BGCOLOR='#4682B4' ALIGN='right' CLASS='titoli'> ".
             
"[url='phpcalendar.php?month=$next&year=$next_yr']<img src=\"images/next_month.gif\" border=0 title=\"Mese Successivo\"> [/url] </TD></TR>";

        echo 
"\n<TR ALIGN='center' CLASS='content'><TD CLASS='content' BGCOLOR=\"#87CEFA\">[B]Dom[/B]</TD><TD CLASS='content' BGCOLOR=\"#87CEFA\">[B]Lun[/B]</TD><TD CLASS='content' BGCOLOR=\"#87CEFA\">[B]Mar[/B]</TD>";
        echo 
"<TD CLASS='content' BGCOLOR=\"#87CEFA\">[B]Mer[/B]</TD><TD CLASS='content' BGCOLOR=\"#87CEFA\">[B]Gio[/B]</TD><TD CLASS='content' BGCOLOR=\"#87CEFA\">[B]Ven[/B]</TD><TD CLASS='content' BGCOLOR=\"#87CEFA\">[B]Sab[/B]</TD></TR>";
        echo 
"<TR><TD COLSPAN=7> </TR><TR ALIGN='center'>";
                
        
$end = ($start_day 4)? 6:5;
        
//ciclo che mi scrive i giorni!!
        
for ($row 01$row <= $end$row++){
            for (
$col 01$col <= 07$col++){
                if (
$dates[$row][$col] == '')    $dates[$row][$col] = ' ';
                        
                if (!
strcmp($dates[$row][$col], ' '))    $count += 1;
                        
                
$t $dates[$row][$col];    
                
$var $t.'/'.$mon.'/'.$year
                        
                
//Controllo se la data è oggi la evidenzio
                
if (($t == date("d")) && ($mon == date("m")) && ($year == date("Y"))){
                    echo 
"\n<TD CLASS='corrente' BGCOLOR=\"#4682B4\">";
                    
//echo "<a href=\"java script:Selezionato('$var')\" TITLE=\"$var\">";
                    
echo "<a href=\"#\" onclick=\"Selezionato('$var');return false;\" TITLE=\"$var\">";
                    echo 
$t."</a></TD>";
                }else{    
//Se il giorno non c'è metto uno spazio
                            
echo "\n<TD  CLASS='titoli' BGCOLOR=\"#87CEFA\">".(($t == " " )? " " :"<a href=\"#\" onclick=\"Selezionato('$var');return false;\" TITLE=\"$var\">".$t)."</a> 
"
;
                        }
                    }
//fine for -colonne
                
                
if (($row 1) != ($end+1))
                    echo 
"</TR>\n<TR ALIGN='center'>";
                else
                    echo 
"</TR>";
            }
//fine for - righe
                    
echo "<TR><TD ALIGN=\"left\" BGCOLOR=\"#4682B4\"><a href=\"phpcalendar.php?month=$month&year=$anno_prima\" title=\"Anno precedente\"><img src=\"images/prev_year.gif\" border=0 title=\"Anno precedente\"></a></TD><TD COLSPAN=5 BGCOLOR=\"#4682B4\"> </TD><TD ALIGN=\"right\" BGCOLOR=\"#4682B4\"><a href=\"phpcalendar.php?month=$month&year=$anno_dopo\" title=\"Anno Successivo\"><img src=\"images/next_year.gif\" border=0 title=\"Anno successivo\"></a></TD></TR>";
        
        echo 
"\n</TABLE>

"
;
        
/*    echo $flag. ' - ';    */
        
if ($flag == '1')    echo "<A HREF=\"phpcalendar.php\" CLASS=\"content\">Visualizza il mese corrente</A></DIV>";
        

    }
    
//----------Main Loop-----------


//Se il mese non è presente lo setto a quello corrente
$month = (empty($month)) ? date("m") : $month;

//Se l'anno non è presente lo setto a quello corrente
$year = (empty($year)) ? date("Y") : $year;

print_HTML_header();

print_calendar($month,$year);

print_HTML_footer();

?>