Board index   FAQ   Search  
Register  Login
Board index PHP PHP General

Need Help with this script

General discussions related to php

Moderators: macek, egami, gesf

Need Help with this script

Postby GK_Anubis » Fri Sep 12, 2003 12:31 pm

Code: Select all
<?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 print "Calendar:
   ".$irstDayArray[ 'month' ]." ".$firstDayArray[ 'year' ] ?></title>
<head>
<body>
<form method ="post" action="<?php print "$_SERVER[PHP_SELF]"; ?>">
<select name="month">
<?php
$months = Array("January", "Feburary", "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 "\toption";
   print ($x == $year)?" SELECTED":"";
   print ">$x\n";
}
?>
</select>
<input type="submit" value='Go!">
</form>
<br>
<?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</td>\n";
}
for ($count=0; $count < (6*7); $count++) {
   $dayArray = getdate($start);
   if (($count % 7) == 0) {
      if ($dayArray[ 'mon' ] != $month) {
         break;
      } else {
         print "</tr><tr>\n"
      }
   }
   if ($count < $firstDayArray[ 'wday' ] || $dayArray[ 'mon' ] != $month) {
      print "\t<td></td>n";
   } else {
      print "\<td>".$dayArray[ 'mday' ]." &nbsp;&nbsp; </td>\n";
      $start += ADAY;
   }
}
print "</tr></table>";
?>
</body>
</html>



Line 60 is the start of the problem so if any1 can tell my fault id b musch ablieged
GK_Anubis
New php-forum User
New php-forum User
 
Posts: 2
Joined: Fri Sep 12, 2003 12:28 pm
Location: United Kingdom

Re: Need Help with this script

Postby swirlee » Fri Sep 12, 2003 1:20 pm

GK_Anubis wrote:Line 60 is the start of the problem so if any1 can tell my fault id b musch ablieged


How about you tell us 1) what you're trying to do, 2) what's happening that you don't want to happen, 3) what you want to happen that isn't happening. Things like error messages, etc. are particularly important. Perhaps you should take a look at the guide.
User avatar
swirlee
Moderator
Moderator
 
Posts: 2272
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back

Postby GK_Anubis » Fri Sep 12, 2003 2:30 pm

I am following a guide.. i finally found the rotten cause of line 60 now im facing this.

http://www.genocidekrew.pwp.blueyonder.co.uk/test/c.php

The guide is a 'Teach Yourself PHP, mySQL and Apache in 24hrs... well lucky i am a quick learner.. i advanced onto thei simple calendar tutorial.

Now I am gettin those annoying N's and /'s for about 30 lines before it shows the calendar :(

Thanx for ya help REALLY APPRECIATE it!!

===

if i can get this script to work then i will try creating some more codin not shown in the book so that people can post events on the calendar, via a login pass..


Gareth
Image
GK_Anubis
New php-forum User
New php-forum User
 
Posts: 2
Joined: Fri Sep 12, 2003 12:28 pm
Location: United Kingdom


Return to PHP General

Who is online

Users browsing this forum: Bing [Bot] and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.