Tuesday 30 April 2019

Undefined index in PHP

It's where you test to see that is isn't there. It should be !isset($_POST['SUBMIT']). This is because the index, SUBMIT, won't be set, thus won't have a value such as true to pass the if(...). isset() checks to see if the index/variable is actually set.


Try this:


    if (!isset($_POST['SUBMIT'])){   //ERROR: Undefined index
?>

Add Employee












SSN
 


}
else {
//code here
}
?>

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...