thank you very much, subwayman, for the vote of confidence, and the suggested solution! fortunately, i have been studying CSS for a while, so i do have some ideas which might make for a nice table design (hehe, although those CSS die-hards would cringe at the suggestion of an html table for layout! 😉
subwayman wrote:What you want to do is not that difficult - but you need to design it carefully from the start and prototype in stages before making it look whizzy. This will allow you to concentrate on the logic and structure without the distraction of design.
wow... i'm so glad you said that. i thought maybe i was being selfish, looking for answers for design issues this "early" in the game. i felt a real need to get this thing hammered out before i was going to feel comfortable concentrating on the logic. one good thing which has happend, however during my struggles in the meantime to come up with some sort of logical presentation, is that i have recognized a few flaws in my table designs.
i was picturing precisely what you have suggested as a best approach.
take a look at this script, taken from Chaper 22 of
Meloni, Julie C.(2003)Teach Yourself PHP, MySQL® and Apache All in One Indianapolis, IN, USA: Sams Publishing
<?php
define("ADAY", (60*60*24));
if (!checkdate($_POST['month'], 1, $_POST['year'])) {
$nowArray = getdate();
$month = $nowArray['mon'];
$year = $nowArray['year'];
} else {
$month = $_POST['month'];
$year = $_POST['year'];
}
$start = mktime (12, 0, 0, $month, 1, $year);
$firstDayArray = getdate($start);
?>
<html>
<head>
<title><?php echo "Calendar:".$firstDayArray['month']."
".$firstDayArray['year'] ?></title>
<link rel="stylesheet" type="text/css" href="css/phpstyle.css" media="all" />
<head>
<body>
<form method="post" action="<?php echo "$_SERVER[PHP_SELF]"; ?>">
<select name="month">
<?php
$months = Array("January", "February", "March", "April", "May",
"June", "July", "August", "September", "October", "November", "December");
for ($x=1; $x <= count($months); $x++) {
echo"<option value=\"$x\"";
if ($x == $month) {
echo " SELECTED";
}
echo ">".$months[$x-1]."";
}
?>
</select>
<select name="year">
<?php
for ($x=1980; $x<=2010; $x++) {
echo "<option";
if ($x == $year) {
echo " SELECTED";
}
echo ">$x";
}
?>
</select>
<input type="submit" value="Go!">
</form>
<br>
<?php
$days = Array("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat");
echo "<TABLE BORDER=1 CELLPADDING=5><tr>\n";
foreach ($days as $day) {
echo "<TD BGCOLOR=\"#CCCCCC\" ALIGN=CENTER><strong>$day</strong></td>\n";
}
for ($count=0; $count < (6*7); $count++) {
$dayArray = getdate($start);
if (($count % 7) == 0) {
if ($dayArray['mon'] != $month) {
break;
} else {
echo "</tr><tr>\n";
}
}
if ($count < $firstDayArray['wday'] || $dayArray['mon'] != $month) {
echo "<td> </td>\n";
} else {
echo "<td>".$dayArray['mday']." </td>\n";
$start += ADAY;
}
}
echo "</tr></table>";
?>
</body>
</html>
following this example, the book goes on to create an Object Class Library for the purpose of making selectable date "pull-downs", or as the book states, a Date Pull-Down Class [Library], which to be honest, it's a little upper-level of complexity which i'm not sure i quite understand, or need in this application. i realize of course that using an Object, and learning to code them into my applications will ultimately be for the better end. the purpose of this particular Date Pull-down Class is so that the user's selected date will be "sticky", that is, it will remain as one date selection throughout the use of the form, even if a new page is loaded (i think that's the idea!).
what's my point?
i'm wondering if i could somehow use the above Calendar Script to make for a dynamically generated calendar table, each with the on-click events such as you have suggested, subwayman.
ideas?