skift månede
Hejjeg har et lille problem, for jeg ved ikke hvordan jeg får kalender til at skifte mellem månederne.
en der vil hjælpe mig med det?
<font style="font-size: 17pt">Kalender</font><br>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%">
<tr>
<td width="128" valign="top">
<?php
include("sql.php");
$query = mysql_query("SELECT * FROM kalender") or die(mysql_error());
$arr = array();
while ($result = mysql_fetch_assoc($query)) {
$arr[$result['date']] = $result;
}
$thismonth = ( int ) date( "m" );
$thisyear = date( "Y" );
$numdaysinmonth = cal_days_in_month( CAL_GREGORIAN, $thismonth, $thisyear );
$jd = cal_to_jd( CAL_GREGORIAN, date( "m" ),date( 1 ), date( "Y" ) );
$startday = jddayofweek( $jd , 0 );
$monthname = jdmonthname( $jd, 1 );
function maandesnavn($monthname)
{
if ($monthname == "January")
{
echo "Januar";
}
elseif ($monthname == "February")
{
echo "Februar";
}
elseif ($monthname == "March")
{
echo "Marts";
}
elseif ($monthname == "April")
{
echo "April";
}
elseif ($monthname == "May")
{
echo "Maj";
}
elseif ($monthname == "June")
{
echo "Juni";
}
elseif ($monthname == "July")
{
echo "Juli";
}
elseif ($monthname == "August")
{
echo "August";
}
elseif ($monthname == "September")
{
echo "September";
}
elseif ($monthname == "October")
{
echo "Oktober";
}
elseif ($monthname == "November")
{
echo "November";
}
elseif ($monthname == "December")
{
echo "December";
}
else
{
echo "fejl";
}
}
?>
<table width="125">
<tr>
<td class="kalender" colspan="7"><div align="center"><strong><? maandesnavn($monthname); ?></strong></div></td>
</tr>
<tr>
<td class="kalender"><strong>Søn</strong></td>
<td class="kalender"><strong>Man</strong></td>
<td class="kalender"><strong>Tir</strong></td>
<td class="kalender"><strong>Ons</strong></td>
<td class="kalender"><strong>Tor</strong></td>
<td class="kalender"><strong>Fre</strong></td>
<td class="kalender"><strong>Lør</strong></td>
</tr>
<tr>
<?php
$emptycells = 0;
for( $counter = 0; $counter < $startday; $counter ++ ) {
echo "\t\t<td class=kalender>-</td>\n";
$emptycells ++;
}
$rowcounter = $emptycells;
$numinrow = 7;
for( $counter = 1; $counter <= $numdaysinmonth; $counter ++ ) {
$rowcounter ++;
$dato = sprintf("%04d-%02d-%02d",$thisyear,$thismonth,$counter);
if(empty($arr[$dato])){
echo "\t\t<td class=kalender>$counter</td>\n";
}else{
$counterdag = $counter;
//hvis ja, så laver vi link:
echo "\t\t<td class=kalender><a href=\"?side=kalender&date=$dato&dagen=$counter. ";
echo maandesnavn($monthname);
echo " $thisyear\"><b><font color=#000000>$counter</font></b></a></td>\n";
}
if( $rowcounter % $numinrow == 0 ) {
echo "\t</tr>\n";
if( $counter < $numdaysinmonth ) {
echo "\t<tr>\n";
}
$rowcounter = 0;
}
}
$numcellsleft = $numinrow - $rowcounter;
if( $numcellsleft != $numinrow ) {
for( $counter = 0; $counter < $numcellsleft; $counter ++ ) {
echo "\t\t<td class=kalender>-</td>\n";
$emptycells ++;
}
}
?>
</tr></table>
</td>
<td width="572" valign="top">
<table border="0" width="100%">
<tr>
<td class="kalenderdag" width="100%"><? $dagen = mysql_real_escape_string($_GET[dagen]); if($_GET[dagen] == ""){echo "..";}else{echo "<b>$dagen</b>";} ?></td>
</tr>
<tr>
<td width="100%">
<?
if($arr[$_GET[date]] == "")
{
echo "Der er ikke oprettet nogen event.";
}
else
{
echo $arr[$_GET[date]][beskrivelse];
}
?>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>