what does this error (PHP Notice: Undefined index) means?

Discussion in 'PHP' started by qistina-87, May 10, 2007.

  1. #1
    can someone tell me what does this error means? n how can i solve it?

    this the error that i m referring to:

    PHP Notice: Undefined index: ISPA_gender in C:\Inetpub\wwwroot\done-all-de-steps\Untitled-6-1n2n3n4nbannern7err.php on line 112
     
    qistina-87, May 10, 2007 IP
  2. gibex

    gibex Active Member

    Messages:
    1,060
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    95
    #2
    "PHP Notice: Undefined index: ISPA_gender" means that there is an expression in your script where $some_array[ISPA_gender] is used but without a value.
     
    gibex, May 10, 2007 IP
  3. qistina-87

    qistina-87 Guest

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    then, how should i solve the error?
     
    qistina-87, May 10, 2007 IP
  4. rodney88

    rodney88 Guest

    Messages:
    480
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    0
    #4
    If you have lots of those notices, you should kick whoever made the script for not coding it properly and make do with hiding them by setting error_reporting to E_ALL ^ E_NOTICE.

    Or you can fix them by going through the script and making sure it only uses defined values. I.e. rather than
    
    $someVar = $someArray['someKey'] 
    // where the someKey value may or may not have been set
    
    // Instead check if its set first
    $someVar = isset($someArray['someKey']) ? $someArray['someKey'] : '';
    PHP:
     
    rodney88, May 11, 2007 IP