The following code give undefined index in XAMPP but not on other APACHE Server is this error only limited to xampp
<?php
if($_POST['names']!=""&&$_POST['n']!="")
{
print_r($_POST);
}
?>
<form action="undefiend_error.php" method="post" >
<input type="text" name="names" value="">
<input type="text" name="n" value="">
<input type="hidden" name="nd" value="">
<input type="submit" value="submit" >
</form>
Undefined index/variable error is limited to erroneous code only.
An erroneous code would always produce an error, despite of the system you running. You can use some settings to gag the error message, but the error itself will remain in your code.
So, you have to corrrect the error, not error message.
To correct this one you have to check if there is should be a variable or not. The Wouter’s method above os okay. So,
will raise an error only when there is absent required field – the thing error messages are for.