PHP - Getting notice Undefined index

When using $ _POST or $ _GET to retrieve the variables from a form, you may encounter this error:

if (!isset($_POST['action']))
{
$_POST['action'] = 'undefine';
}
<?php error_reporting (E_ALL ^ E_NOTICE); ?>