The first problem I see is that, while already in PHP mode (i.e., entering code between the <?php and ?> tags), you have tried to enter PHP mode again, which you can't do. For example:
<!-- Display input variables B -->
printf("<td width=\"21\">¡¡</td>\n");
printf("<td width=\"150\" colspan=\"2\"><input type=\"text\" name=\"record_b\" value=\"<\?php echo \$_POST['record_b'] ?>\" size=\"15\"></td>\n");
printf("</tr></table>\n");
This is a block of code taken from your post. Notice, on the third line, that you are trying to use the <?php ?> tags again, even though you are already in PHP mode. This causes problems.
The easiest thing would probably be to not be in php mode for the majority of the HTML text, and only use it as needed. For example:
<?php
// Put whatever PHP pre-processing needed here
?>
<!-- table in HTML -->
<table border="0" width="438" height="20">
<tr><td width="432">Add Records</td></tr>
</table>
<table width="435"><tr>
<!-- Display titles -->
<td width="16">¡¡</td>
<td width="249" colspan="2">Record A</td>
<td width="21" >¡¡</td>
<td width="150" colspan="2">Record B</td>
</tr>
<tr>
<!-- Display input variables A -->
<td width="16">¡¡</td>
<td width="249" colspan="2"><input type="text" name="record_a" value="<?php echo $_POST['record_a']; ?>" size="32"></td>
<!-- Display input variables B -->
<td width="21">¡¡</td>
<td width="150" colspan="2"><input type="text" name="record_b" value="<?php echo $_POST['record_b']; ?>" size="15"></td>
</tr></table>
<html>
<head><title>Add Records</title></head>
<body bgcolor="#CCCCFF">
</body>
</html>
The only other thing I can immediately see is that you should move the table code down so that it is betweeen the <body></body> tags.
Good Luck!