homepage Welcome to WebmasterWorld Guest from 54.167.238.60
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
PHP Notice: Undefined index
Othenz




msg:3144687
 7:56 am on Nov 3, 2006 (gmt 0)

I got this error message below. How can i fix it...

PHP Notice: Undefined index: REQUEST_URI in c:\inetpub\wwwroot\guestbook\guestbook.php on line 41 PHP Warning: Cannot add header information - headers already sent in c:\inetpub\wwwroot\guestbook\guestbook.php on line 41

any help is very much appreciated.

 

jatar_k




msg:3144707
 8:38 am on Nov 3, 2006 (gmt 0)

Welcome to WebmasterWorld Othenz,

what is on line 41?

is this stopping your script? I notice the headers already sent error there too.

eelixduppy




msg:3144808
 11:28 am on Nov 3, 2006 (gmt 0)

Welcome!

My guess is that you just don't have quotation marks around the array index like so:

$_SERVER[[b]"[/b]REQUEST_URI[b]"[/b]]

Also, to get rid of the header warning you must place any calls to header [us2.php.net] before any text is output to the browser. Read it's documentation for some other fixes regarding using output buffers.

Good luck!

[edit]
Ok I take back my guess, because it throws a different error (I should have known, too)

So yes, what's that line of code :)
[/edit]

dreamcatcher




msg:3145512
 11:19 pm on Nov 3, 2006 (gmt 0)

The header error is appearing because of the text generated by the undefined error. Check out eelixduppy's excellent advice, which I`m sure is the problem.

dc

Othenz




msg:3144681
 7:51 am on Nov 3, 2006 (gmt 0)


System: The following 2 messages were spliced on to this thread from: http://www.webmasterworld.com/php/3146246.htm [webmasterworld.com] by coopster - 4:54 pm on Nov. 6, 2006 (utc -6)


I got this error message below in my php guestbook. I'm using IIS as my webserver.

[1]PHP Notice: Undefined index: REQUEST_URI in c:\inetpub\wwwroot\guestbook\guestbook.php on line 41 PHP Warning: Cannot add header information - headers already sent in c:\inetpub\wwwroot\guestbook\guestbook.php on line 41 [1]

I don't know what went wrong...

Any help is very much appreciated...

coopster




msg:3147994
 10:49 pm on Nov 6, 2006 (gmt 0)

Welcome to WebmasterWorld, Othenz.

The headers already sent error is being thrown because of the NOTICE error being dumped to the browser first. You cannot have any output whatsoever prior to the header [php.net] function, including errors.

But, that error is secondary. First, you need to find out why you don't have a REQUEST_URI index in your $_SERVER superglobal. I'm guessing it is because you are running IIS and there is no index of REQUEST_URI (you will indeed find that index in on an Apache HTTP server though). You may have to find out the equivalent on IIS.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved