Home » Php » php – How is it possible that isset() is not redirecting and so I get a undefined index error?

php – How is it possible that isset() is not redirecting and so I get a undefined index error?

Posted by: admin February 25, 2020 Leave a comment

Questions:

Below the first 12 lines of code of the file DOCopenBestaandLokaalReactie.php

<!DOCTYPE html>
<?php
if (!isset($_POST["lokaalnummer"]))
{
header('Location: https://wiskundelokaal.nl/DOCopenBestaandLokaal.php');
}
function removeHackDirt($inputstring)
{
   $resultString = htmlentities($inputstring);
   return $resultString;
}
$_POST["lokaalnummer"] = removeHackDirt($_POST["lokaalnummer"]);

How is it ever possible to generate this error:

FastCGI: server “/var/run/php72-cgi/php-cgi” stderr: PHP message: PHP
Notice: Undefined index: lokaalnummer in
/www/DOCopenBestaandLokaalReactie.php on line 12

It should never reach line 12…(?)

How to&Answers: