[Solved] Undefined index: level


On this line…

else if ($_GET['level'] < 1 || $_GET['level'] > 10 )

like in the previous test where you check is set before checking it’s numeric, you need to check it here as well…

else if (isset($_GET['level']) && ($_GET['level'] < 1 || $_GET['level'] > 10 ))

or restructure the code something like…

else if (isset($_GET['level'])) {
    if (!is_numeric($_GET['level']))
    {
        $code_error = 2;
        $message = "The level must be numeric ! ";
    }

    else if ($_GET['level'] < 1 || $_GET['level'] > 10 )
    {
        $code_error = 3;
        $message = "The level must be between 1 and 10 ";
    }    
}

0

solved Undefined index: level