It's where you test to see that is isn't there. It should be !isset($_POST['SUBMIT'])
. This is because the index, SUBMIT
, won't be set, thus won't have a value such as true to pass the if(...)
. isset()
checks to see if the index/variable is actually set.
Try this:
<?php
if (!isset($_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
}
?>