SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict Divisive Cotton's Avatar
    Join Date
    Jun 2008
    Location
    Andy lives in London, UK
    Posts
    393
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Notice: Undefined index

    I've just undertaken a fresh install of Windows on my pc and reinstalled WAMP... now I'm using exactly the same code but I'm getting errors like below all over it.

    Is this something to do with changed settings in php.ini?

    Code:
    Notice: Undefined index: category in C:\wamp\www\includes\header.php on line 8
    Notice: Undefined index: page in C:\wamp\www\includes\header.php on line 13
    Notice: Undefined variable: sel_cat in C:\wamp\www\includes\header.php on line 36
    Let everyday be Christmas

  2. #2
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2008
    Posts
    5,757
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, your php.ini was likely changed. Currently, you have it at a level which reports E_NOTICE level errors. This is a great level to use for developing and debugging. The default is E_ALL & ~E_NOTICE, which you can set in php.ini. find php.ini by calling phpinfo(). restart webserver for settings to take effect.

  3. #3
    SitePoint Addict Divisive Cotton's Avatar
    Join Date
    Jun 2008
    Location
    Andy lives in London, UK
    Posts
    393
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The first question, should I be paying any attenton to these warnings, and which of the following options should php.ini be set?

    ;error_reporting = E_ALL & ~E_NOTICE
    ;
    ; - Show all errors, except for notices
    ;
    ;error_reporting = E_ALL & ~E_NOTICE | E_STRICT
    ;
    ; - Show only errors
    ;
    ;error_reporting = E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR
    ;
    ; - Show all errors, except coding standards warnings
    ;
    Let everyday be Christmas

  4. #4
    SitePoint Wizard wheeler's Avatar
    Join Date
    Mar 2006
    Location
    Gold Coast, Australia
    Posts
    1,369
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes, you should be paying attention - quite simply you have to declare a variable before you try and use it, even if you give it a blank value. It will make life that little bit easier to make sure your scripts are complete in this way.
    Studiotime - Time Management for Web Developers
    to-do's, messages, invoicing, reporting - 30 day free trial!
    Thomas Multimedia Web Development


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •