Ok to break it down. This is how I do a self submitting form.
<? if (!isset($_POST['submit'])) { ?>
<form method="post" action="testform.php">
<input name="first_name" type="text">
<input name="surname" type="text">
<input type="submit" name="submit" value="Send Enquiry">
<form>
<?
} else {
if ($first_name) { echo"Please enter first name"; exit(); }
if ($surname) { echo"Please enter surname"; exit(); }}
echo "Form submitted";
?>