Please anyone solve my problem my code execute automatically. Here it is.
$con=mysql_connect("localhost","root","") or die('Not Connected');;
mysql_select_db("reg");
if (isset($_POST['submit'])) {
    $fname = $_POST['fname'];
    $lname = $_POST['lname'];
    $email = $_POST['email'];
    $username = $_POST['user'];
    $password = $_POST['password'];
    $cpassword = $_POST['cpassword'];
    if($fname=='' or $lname=='' or $email=='' or $username==''
        or $password=='' or $cpassword==''){
        echo "<script>alert('Please Fill Out Blank Fields')</script>";
        exit();
    }
}
$query="INSERT INTO `form`(`ID`, `fname`, `lname`, `email`, `username`, `password`, `cpassword`)
VALUES (NULL, '$fname','$lname','$email','$username','$password','$cpassword')";
if (mysql_query($query)) {
    echo "<script>alert('Registered Successfully')</script>";
}
"Here is my question: Is that when i refresh the page the last code executes automatically" Please check my code.
Thanks.
 
     
     
     
    