pls i am new . i managed to copy this script and adjusted it a bit to work but it is not working well. it displays the calendar of june 2010 but no other month . if i select another month and year it gives the following error.
"you do not have permission to access /bookings/< on this server" . bookings is the folder where i saved the web page. pls what do you think is wrong. the sever i am using is wamp5. it is installed on my laptop. the code is below. after a click on the GO button , it is supposed to call it self but instead it displays that error on the browser. pls help me out thank you.
<?php
define("ADAY", (60*60*24) );
if ( ! checkdate( $month, 1, $year ) )
{
$nowArray = getdate();
$month = $nowArray[mon];
$year = $nowArray[year];
}
$start = mktime ( 0, 0, 0, $month, 1, $year );
$firstDayArray = getdate($start);
?>
<html>
<head>
<title><?php print "Calendar: $firstDayArray[month]
$firstDayArray[year]" ?></title>
<head>
<body>
<form action="<? print $PHP_SELF;?>" method="post">
<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++ )
{
print "\t<option value=\"$x\"";
print ($x == $month)?" SELECTED":"";
print ">".$months[$x- 1]."\n";
}
?>
</select>
<select name="year">
<?php
for ( $x=1980; $x<2010; $x++ )
{
print "\t<option";
print ($x == $year)?" SELECTED":"";
print ">$x\n";
}
?>
</select>
<input type="submit" value="Go!">
</form>
<p>
<?php
$days = Array("Sunday", "Monday", "Tuesday", "Wednesday",
"Thursday", "Friday", "Saturday");
print "<TABLE BORDER = 1 CELLPADDING=5>\n";
foreach ( $days as $day )
print "\t<td><b>$day</b></td>\n";
for ( $count=0; $count < (6*7); $count++ )
{
$dayArray = getdate( $start );
if ( (($count) % 7) == 0 )
{
if ( $dayArray[mon] != $month )
break;
print "</tr><tr>\n";
}
if ( $count < $firstDayArray[wday] || $dayArray[mon] != $month )
{
print "\t<td><br></td>\n";
}
else
{
print "\t<td>$dayArray[mday] $dayArray[month]</td>\n";
$start += ADAY;
}
}
print "</tr></table>";
?>
</body>
</html>
calendar script
Moderator: General Moderators
-
internet-solution
- Forum Contributor
- Posts: 220
- Joined: Thu May 27, 2010 6:27 am
- Location: UK
Re: calendar script
Welcome to the topic. Please uses synatx=php tag for posting php code.
Try deleting the $PHP_SELF from the code and see if it works. see below
Try deleting the $PHP_SELF from the code and see if it works. see below
Code: Select all
<form method="post">