Local variables have a
scope. That means that they are only accessible within the block where they are defined. See
PHP: Variable scope - Manual[
^].
The variables from your error messages are defined in a block enclosed by two
if
conditions. So you can use them only within this block.
A possible solution would be defining them on top of the code with empty content:
$item_id = '';
$item_name = '';
$description = '';
$item_category = '';
$pic = '';
if (isset($_POST['updateitem']))
{
}
However, you would probably have to add an additional check to define what is displayed when the variables has not been set (are still empty).