Possible Duplicate:
PHP: “Notice: Undefined variable” and “Notice: Undefined index”
Good day!
I am having the following error in my code:
<?php
if (!$_POST['SUBMIT']){ //ERROR: Undefined index
?>
<H2>Add Employee</H2>
<form action="<?php print $_SERVER['PHP_SELF']; ?>" method="POST">
<table width="400" border="0" cellspacing="1" cellpadding="2">
<tr>
<td width="100">SSN</td>
<td><input name="SSN" type="text" id="SSN"></td>
</tr>
<tr>
<td width="100"> </td>
<td><input name="SUBMIT" type="SUBMIT" id="ADD" value="ADD"></td>
</tr>
</table>
</form>
<?php
}
else {
//code here
}
?>
How can I remove the error above? Thank you.
It should be a notice and not an error.
To fix is you'll have to check whether $_POST['submit']
is set:
if(!isset($_POST['submit'])) {
...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With