Form submit problem

I have a php page which has a form. The page posts to itself and there are conditions which have to be met. The problem I have is that when the page is loaded, the form submits itself. How can I stop it sending the form data unless the submit button is pressed and all criteria is met?

<?php

$status="OK";
$error = "";
$thanks="";

//***you can edit the text here***
$text = "text here";

if (isset($_POST['Submit'])) {//if 1
	
	$email = strip_tags($_POST['email']);
	$eng1 = strip_tags($_POST['eng1']);
	$eng2 = strip_tags($_POST['eng2']);
	$eng3 = strip_tags($_POST['eng3']);
	$usa = strip_tags($_POST['usa']);
	$alg = strip_tags($_POST['algeria']);
	$slo = strip_tags($_POST['slovenia']);


	$query = mysql_query("SELECT email FROM user WHERE email = '$email' ");
	if (mysql_num_rows($query) > 0){
    $error = "Sorry that email has already been used";
	$status= "NOTOK";
	}

	if(substr_count($email,"@") > 1){
	$error ="Use only one email address<BR>"; 
	$status= "NOTOK";
	}
	
	if (!eregi("^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,3})$", $email)){ // checking your email 
	$error ="Your email address is not correct<BR>"; 
	$status= "NOTOK";}
	
	if (!is_numeric($eng1)) {
		$error ="Please enter a number only for England's score against USA";
		$status= "NOTOK";
	} else if (!is_numeric($eng2)) {
		$error ="Please enter a number only for England's score against Algeria";
		$status= "NOTOK";
	} else if (!is_numeric($eng3)) {
		$error ="Please enter a number only for England's score against Slovenia";
		$status= "NOTOK";
	} else if (!is_numeric($usa)) {
		$error ="Please enter a number only for USA's score against England";
		$status= "NOTOK";
	} else if (!is_numeric($alg)) {
		$error ="Please enter a number only for Algeria's score against England";
		$status= "NOTOK";
	} else if (!is_numeric($slo)) {
		$error ="Please enter a number only for Slovenia's score against England";
		$status= "NOTOK";
	}
	
}//end of if 1

if($status == "OK") {//if 2
	$sql = "INSERT INTO `user` (`email`, `eng1`, `eng2`, `eng3`, `usa`, `algeria`, `slovenia`) VALUES ('$email', '$eng1', '$eng2', '$eng3', '$usa', '$alg', '$slo')";
	$perform_insert = mysql_query($sql) or die("<b>Data could not be entered");
	
	$thanks = "Thank you for entering your predictions and good luck!<br />";
	
	//unset vartiables
	unset($email); unset($eng1); unset($eng2); unset($eng3); unset($usa); unset($alg); unset($slo); unset($status); unset($error);
	

}//end of if 2

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Win Big Prizes. Predict England's group matches.</title>
<meta name="description" content="Predict England's group matches in order to be enered into a prize draw. Win big prizes for every England group match." />
<meta name="keywords" content="world cup, england matches, win prizes, world cup prediction, prediction prizes" />
<style type="text/css">
<!--
body,p,td,th {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 11px;
	color: #000000;
	margin: 0;
	margin-top: 1px;
}

.tableoffer {
background-color: #FAFAFA;
border: 1px solid #DDD;
padding:0 0 5px 0;
}

.headercentreprice {
color:#990000;
font-weight:bold;
}

.error {
color: #990000;
font-weight: bold;
}
-->
</style>
</head>

<body>
<table width="80%" border="0" align="center" cellpadding="3" cellspacing="3" class="tableoffer">
  <tr>
    <td><div align="center" class="headercentreprice">England World Cup Predictor </div></td>
  </tr>
  <tr>
    <td><?php echo $text ;?> </td>
  </tr>
  <tr>
    <td><div align="center">
	<form method="post" action="<?=$PHP_SELF;?>" id="predict">
      <table width="50%" border="0" cellspacing="2" cellpadding="2" class="tableoffer">
        <tr>
          <td width="50%"><div align="right">Please enter your email address: </div></td>
          <td width="50%"><input name="email" type="text" size="40" maxlength="50" value="<?php echo $email; ?>">
		</td>
        </tr>
      </table>
	  <br>
	  <table width="50%" border="0" cellspacing="2" cellpadding="2" class="tableoffer">
        <tr>
          <td colspan="2"><div align="center"><strong>Group C Match 1 </strong></div></td>
          </tr>
        <tr>
          <td width="50%"><div align="center">England</div></td>
          <td width="50%"><div align="center">USA</div></td>
        </tr>
        <tr>
          <td><div align="center">
            <label>
            <input name="eng1" type="text" size="2" value="<?php echo $eng1; ?>">
            </label>
          </div></td>
          <td><div align="center">
            <label>
            <input name="usa" type="text" size="2" value="<?php echo $usa; ?>">
            </label>
          </div></td>
        </tr>
      </table>
      <br>
        <table width="50%" border="0" cellspacing="2" cellpadding="2" class="tableoffer">
        <tr>
          <td colspan="2"><div align="center"><strong>Group C Match 2 </strong></div></td>
          </tr>
        <tr>
          <td width="50%"><div align="center">England</div></td>
          <td width="50%"><div align="center">Algeria</div></td>
        </tr>
        <tr>
          <td><div align="center">
            <input name="eng2" type="text" size="2" value="<?php echo $eng2; ?>">
          </div></td>
          <td><div align="center">
            <input name="algeria" type="text" size="2" value="<?php echo $alg; ?>">
          </div></td>
        </tr>
      </table>
        <br>
        <table width="50%" border="0" cellspacing="2" cellpadding="2" class="tableoffer">
        <tr>
          <td colspan="2"><div align="center"><strong>Group C Match 3 </strong></div></td>
          </tr>
        <tr>
          <td><div align="center">England</div></td>
          <td><div align="center">Slovenia</div></td>
        </tr>
        <tr>
          <td><div align="center">
            <input name="eng3" type="text" size="2" value="<?php echo $eng3; ?>">
          </div></td>
          <td><div align="center">
            <input name="slovenia" type="text" size="2" value="<?php echo $slo; ?>">
          </div></td>
        </tr>
        <tr>
          <td> </td>
          <td> </td>
        </tr>
        <tr>
		<tr>
			<td colspan="2" align="center" class="error"><?php echo $error; ?></td>
		</tr>
          <td colspan="2"><div align="center">
            <input type="submit" name="Submit" value="Submit Your Predictions">
          </div></td>
		  </tr>
		  <tr>
		  <td colspan="2" align="center"><strong><?php echo $thanks; ?></strong></td>
          </tr>
      </table>
	  </form>
      </div></td>
  </tr>
</table>
</body>
</html>

thanks for the reply, just realised why it wasn’t working and fixed it. I had a set of conditions to be met which I had set the passed condition out side the main if condition loop. I put inside the main loop and it works fine.

On the very first line you set $status to have the value “OK”. Later you check $status has the value “OK” (which it does), so then the database insert is carried out.

I think you need to set $status to “NOT OK” (or something, you might simply want to use true or false instead of a text value) at the start of the file.