io ho uno script di un calendario, l'avevo trovato su freephp e l'ho riadattato alle mie esigenze, ti permette di navigare fra i vari mesi, puoi selezionare qualsiasi data e automaticamente te la mette nel campo di testo del form.

Dunque lo script è questo, è lungo, ma basta che lo copi e lo metti per intero in un tuo file, poi te lo potrai studiare con calma:

codice:
<link href="up.css" rel="stylesheet" type="text/css">
<script language="Javascript">
function Selezionato(data)
{
	window.opener.document.form1.data.value = data;
	window.close();
}
</script>

<?
//----------------- This function is to do the HTML header chore ---------------------

function print_HTML_header()
{
	global $flag;
	/*	echo "Mese: ".$_GET['month'];	
	echo "
Anno: ".$_GET['year'];	*/
	$flag = (isset($_GET['month']) && ($_GET['month'] <> date("n") || $_GET['year'] <> date("Y"))) ? 1 : 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("n",$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("n");	}
		
		echo 	"\n<TR ALIGN='center'><TD BGCOLOR='#4682B4' ALIGN='left' CLASS='titoli'> ".
			 "<img src=\"images/prev_month.gif\" border=0 title=\"Mese precedente\"> </TD>".
			 "<TD COLSPAN=5 BGCOLOR='#4682B4' ALIGN='center' CLASS='corrente'>".$mese." ".$temp_yr."</TD>".
			 "<TD BGCOLOR='#4682B4' ALIGN='right' CLASS='titoli'> ".
			 "<img src=\"images/next_month.gif\" border=0 title=\"Mese Successivo\">  </TD></TR>";

		echo "\n<TR ALIGN='center' CLASS='content'><TD CLASS='content' BGCOLOR=\"#87CEFA\">Dom</TD><TD CLASS='content' BGCOLOR=\"#87CEFA\">Lun</TD><TD CLASS='content' BGCOLOR=\"#87CEFA\">Mar</TD>";
		echo "<TD CLASS='content' BGCOLOR=\"#87CEFA\">Mer</TD><TD CLASS='content' BGCOLOR=\"#87CEFA\">Gio</TD><TD CLASS='content' BGCOLOR=\"#87CEFA\">Ven</TD><TD CLASS='content' BGCOLOR=\"#87CEFA\">Sab</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 = 1; $row <= $end; $row++){
			for ($col = 1; $col <= 7; $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("j")) && ($mon == date("n")) && ($year == date("Y"))){
					echo "\n<TD CLASS='corrente' BGCOLOR=\"#4682B4\">";
					echo "<a href=\"javascript:Selezionato('$var')\" 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=\"javascript:Selezionato('$var')\" TITLE=\"$var\">".$t)."</a></TD>";
						}
					}//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("n") : $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();

?>
la funzione in js che vedi all'inizio:
<script language="Javascript">
function Selezionato(data)
{
window.opener.document.form1.data.value = data;
window.close();
}
</script>

è quella che ti permette di mettere la data che hai selezionato nel campo data del tuo form (mi raccomando controlla i nomi dei campi). In questo caso naturalmente il calendario si deve aprire in una popUp, altrimenti non funziona.