删除未定义的索引[重复]

None of the solutions in the other threads were clear. I need help removed the undefined message. The line of code that is causing it is this variable:

$ain = $_Get['AIN'];

Other threads mentioned using upset although I could not follow. I want to be able to pass a value in whether it is null or not.

</div>

You have to check the existence of the array index before using it, and provide an alternative value to use in case it isn't set.

For example:

if(isset($_GET['AIN'])){
  //The value is set and you can use it
  $ain = $_GET['AIN'];
} else {
  //The value is not set, so you should provide a default value
  $ain = NULL;
}

Also note that the PHP language is case sensitive, so if you want to refer to HTTP GET parameters, you should use $_GET, because $_Get will not work.

Assuming you meant to reference the superglobal $_GET, you can use one of the following:

<?php
$ain = 'default';
if(isset($_GET['AIN']))
    $ain = $_GET['AIN'];

Or use the ternary:

<?php
$ain = isset($_GET['AIN']) ? $_GET['AIN'] : 'default';

Or the shortest with the null-coalescing operator:

<?php
$ain = $_GET['AIN'] ?? 'default';