Possible Duplicate:
PHP: “Notice: Undefined variable” and “Notice: Undefined index”
When do we get this error?
Notice: Undefined index: submit in C:\wamp\www\sample.php on line 25
What is the exact meaning of this perticular error?
Possible Duplicate:
PHP: “Notice: Undefined variable” and “Notice: Undefined index”
When do we get this error?
Notice: Undefined index: submit in C:\wamp\www\sample.php on line 25
What is the exact meaning of this perticular error?
This means exactly what it says: you're addressing to an undefined index in an array
$arr = array();
echo $arr['foo'];
In the example above the array is empty but I tried to output 'foo'
item value, which doesn't exist.
It means you are trying to access a part of an arraythat isn't there.
If you have an array with 5 elements, you ca get to them via:
$array[0]
through to $array[4]
But if you try $array[76]
which doesn't exist, you will get an undefined Index error.
You've probably got an array that you're accessing like $_POST['submit']
. That error message is saying is the element 'submit' of the array doesn't exist, and it's throwing a warning.
You should check that array elements exist before using them isset()
before you access them to avoid avoid the warning.
Edit: possible duplicate of this: Undefined index in PHP
have you correctly mentioned the method in your form GET
or POST
?? I think you are accessing/testing it without declaring it. Let me know if this is the case.