Which is quite inefficient and just plain... bad (no offense) to do. What you need to realize is that PHP doesn't know what a form is - it's going to run each line every time the script is run, regardless of whether or not the user has even seen the form yet.
What you need to do, then, is tell PHP to only run the INSERT query and all of that code if the user has submitted the form. One way to do this is to wrap the code that relies on form submission in code such as:
if(!empty($_POST)) {
// $_POST contains data - process it here
}
Better yet, though, you should make sure the data you need is there as well:
if(!empty($_POST)) {
$FirstName = (isset($_POST['FirstName']) ? $_POST['FirstName'] : '');
// etc.
}
That way you won't cause warnings if one or more variables aren't there.
Another important piece of advice is this: you should never place user-supplied data directly into a SQL query else you're leaving yourself vulnerable to SQL injection attacks. To protect yourself (and prevent the user from accidentally breaking your query), you must use a function such as [man]mysql_real_escape_string/man on all user supplied data before it's placed into a SQL query.