It is currently Sat Feb 04, 2012 3:40 pm

All times are UTC + 2 hours [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: PHP Notice: Undefined index:year
PostPosted: Sat May 03, 2008 1:11 pm 
Offline

Joined: Tue Mar 18, 2008 7:52 am
Posts: 2
Hi,

I have a calendar page which actually loads fine.
The calendar code starts like this.

Code:
require_once("include/inc_calendar.class.php");
$oCalendar = new inc_calendar();
$month = $_REQUEST['month'];
$year = $_REQUEST['year'];
$oCalendar->dateNow($month,$year);


Though I am able to see the calendar, each time I navigate to this page the errorlog logs the below notice.
I believe that the notice is indicating that the index value month is not set.
Please suggest measures to fix this.

Code:
[Sat May 03 14:29:50 2008] [error] [client 127.0.0.1] PHP Notice:  Undefined index:  year in C:\\Program Files\\Apache Group\\Apache2\\htdocs\\mysite\\view_calendar.php on line 5, referer: http://localhost:8080/mysite/menu.php
[Sat May 03 14:32:08 2008] [error] [client 127.0.0.1] PHP Notice:  Use of undefined constant sortcriteria - assumed 'sortcriteria' in C:\\Program Files\\Apache Group\\Apache2\\htdocs\\mysite\\kbmain.php on line 43, referer: http://localhost:8080/mysite/kbcategory.php :)


Thank you
Sriram


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 03, 2008 1:48 pm 
Offline

Joined: Sat Mar 22, 2008 9:04 pm
Posts: 33
Are you getting the proper values in $_REQUEST['month'] and $_REQUEST['year']?

_________________
Linux, Apache, MySQL, PHP


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 11, 2008 4:47 am 
Offline

Joined: Sun May 02, 2004 11:34 pm
Posts: 6498
Location: toronto, canada
Just initialize the variable before using it...

Code:
$year = date("Y") ; //assumes integer of current year

_________________
Lostboy

Cat, the other other white meat

Please read Posting Etiquette before posting

You can always try Google


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 2 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron