Calendar

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
trock74
Forum Newbie
Posts: 6
Joined: Mon Jun 12, 2006 10:05 pm

Calendar

Post by trock74 »

Jcart | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


I'm trying to create a calendar with the format listed below but I prefer to have everything in a loop and can not seem to get the code to display correctly. I trying to do one thing at a time with just display the year and months first before I display the dates. Any suggestion?

calendar.php

Code: Select all

<?php
$nmon = $_REQUEST["nmon"]; // pull number of days of the month from sever
$nyear = $_REQUEST["nyear"]; // pull current year
// set number of days in the given month
$ndays = date("t", mktime(0,0,0,$nmon,1,$nyear));
// set Textual representation of a month
$tmon = date("F", mktime(0,0,0,$nmon,1,$nyear));

// this will display my 1-31 days
for ($x=1; $x<=$ndays;$x++)
{
   $myday = date("l", mktime(0,0,0,$nmon,$x,$nyear));
   echo "<tr valign='top'>\n";
   echo "<td align='left'><font size='2' face='verdana, arial, sans-serif'><b>$myday $tmon $x, $nyear</b></font></td>\n";
   echo "</tr>\n";
   echo "<tr valign='top'>\n";
   echo "<td align='left'><font size='2' face='verdana, arial, sans-serif'>I am testing</font></td>\n";
   echo "</tr>\n";
}
I want the display to look like this listed below.

Code: Select all

2006                                       2007
      Jun  Jul  Aug  Sep  Oct  Nov  Dec  Jan  Feb  Mar  Apr  May
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

Jcart | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Post Reply