-2

I'm facing some warning error how can solve this below are my php code i have pasted please check my code. I'm getting error like this: (Warning: Undefined array key "age" in C:\xampp) (Warning: Undefined array key "state" in C:\xampp)

I'm getting error is this else part($age = $_GET["age"];) and($state = $_GET["state"];)

Php code:

if (isset($_POST["age"])) {
        $age = $_POST["age"];
    } else {
        $age = $_GET["age"];
    }

    if (isset($_POST["state"])) {
        $state = $_POST["state"];
    } else {
        $state = $_GET["state"];
    }
Makizh
  • 1
  • 1
  • Does this answer your question? [PHP: Fastest way to handle undefined array key](https://stackoverflow.com/questions/16675753/php-fastest-way-to-handle-undefined-array-key). Warning _Undefined array key_ means that array key is undefined. Probably `age` or `state` is not present in `$_GET`. – Jax-p May 30 '22 at 10:29
  • Hi, Please i did not getting ..... – Makizh May 30 '22 at 10:37

0 Answers0