php check for undefined index code example
Example 1: if exist php
if (isset($var)) {
// Code here
}
Example 2: php undefined index
// Your array index has no value or is not referencing anything,
// The easiest way to overcome this is to simply check whether
// it has been defined
if (isset($arr[$i])) {
// Do something
}
Example 3: php Undefined index: error
// Before using $_POST['value'] if (isset($_POST['value'])) { // Instructions if $_POST['value'] exist }