Hi all, i'm working on a project where I have this form which when submitted dumps the fields into a database. Once the form data is stored however, I wanted the page to redirect to a 2nd page.

I thought this could be done by simply adding a line at the bottom of my data submission script which would say something like:

Code:
header("Location: http://www.test.com/page2.html");
When I add that bit of code I get errors on the page.

Any suggestions on how to get this to work? or is my code just bugged.

Heres my source code:

Code:
<!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=utf-8" />
<title>EasyMoney4YouOnline.com | Sign up now to receive your money</title>
<link href="css/main.css" rel="stylesheet" type="text/css" />
<?
#SUBMITS DATA FIELDS TO THE DATABASE
	 include('connection.php');
     $FirstName = $_POST['FirstName'];
	 $LastName = $_POST['LastName'];
     $Address   = $_POST['Address'];
	 $City   = $_POST['City'];
	 $State   = $_POST['State'];
	 $Zipcode   = $_POST['Zipcode'];
	 $Email     = $_POST['Email']; 

	 if (isset($FirstName)) {
        $strSQL = "INSERT INTO UserData (FirstName, LastName, Address, City, State, Zipcode, Email) Values ('" . $FirstName . "','" . $LastName . "','" .$Address . "','".$City . "','" .$State . "','" .$Zipcode . "','" .$Email . "')" ;          
        $strResult = mysql_query($strSQL) or die(mysql_errno() . " : " . mysql_error() . "  <strong>Insert Failed for Some Reason</strong>");  
     }
?>
</head>

<body>
<div class="container">
	<div class="header"><a href="index.html"><img src="images/header.jpg" alt="Cash In Your Hands! The Fast and Easy Way."  width="862" height="190"/></a></div>
    <div class="bar_2">Provide Your Shipping Information</div>
    <div class="content">
		<div class="faqs_text">
			<div>
			<form action="<?php echo $_SERVER[PHP_SELF]; ?>" method="post">
                <fieldset><legend style="color:#000000;">Please fill out the form to continue to your offer.</legend>
					<p>
					<div>
						<span style="float:left; width:150px; font-weight:bold;">First Name:</span>
						<input type="text" name="FirstName" size="20" maxlength="40" value="<?php if (isset($_POST['FirstName'])) echo $_POST['FirstName']; ?>"/>
					</div>
					<div style="text-indent:150px; color:#CC3300; font-size:10px; height:20px;">
						<?php
							if (isset($_POST['submit'])) {
								if (strlen($_POST ['FirstName']) > 0) {
									$name = TRUE;
								}else{
									$name = FALSE;
									echo'You forgot to enter your first name!';
								}
							}
						?>
					</div>
					</p>
					
					<div>
						<span style="float:left; width:150px; font-weight:bold;">Last Name:</span>
						<input type="text" name="LastName" size="20" maxlength="40" value="<?php if (isset($_POST['LastName'])) echo $_POST['LastName']; ?>"/>
					</div>
					<div style="text-indent:150px; color:#CC3300; font-size:10px; height:20px;">
						<?php
							if (isset($_POST['submit'])) {
								if (strlen($_POST ['LastName']) > 0) {
									$name = TRUE;
								}else{
									$name = FALSE;
									echo'You forgot to enter your last name!';
								}
							}
						?>
					</div>
					
					<div>
						<span style="float:left; width:150px; font-weight:bold;">Email Address:</span>
						<input type="text" name="email" size="40" maxlength="60" value="<?php if (isset($_POST['email'])) echo $_POST['email']; ?>"/>
					</div>
					<div style="text-indent:150px; color:#CC3300; font-size:10px; height:20px;">
						<?php
							if (isset($_POST['submit'])) {
								if (strlen($_POST ['email']) > 0) {
									$email = TRUE;
								}else{
									$email = FALSE;
									echo'You forgot to enter your email address!';
								}
							}
						?>
					</div>
					
					<div>
						<span style="float:left; width:150px; font-weight:bold;">Shipping Address:</span>
						<input type="text" name="address" size="50" maxlength="90" value="<?php if (isset($_POST['address'])) echo $_POST['address']; ?>"/>
					</div>
					<div style="text-indent:150px; color:#CC3300; font-size:10px; height:20px;">
						<?php
							if (isset($_POST['submit'])) {
								if (strlen($_POST ['address']) > 0) {
									$address = TRUE;
								}else{
									$address = FALSE;
									echo'You forgot to enter your mailing address!';
								}
							}
						?>
					</div>
					
					<div>
						<span style="float:left; width:150px; font-weight:bold;">City:</span>
						<input type="text" name="city" size="15" maxlength="20" value="<?php if (isset($_POST['city'])) echo $_POST['city']; ?>"/>
					</div>
					<div style="text-indent:150px; color:#CC3300; font-size:10px; height:20px;">
						<?php
							if (isset($_POST['submit'])) {
								if (strlen($_POST ['city']) > 0) {
									$city = TRUE;
								}else{
									$city = FALSE;
									echo'You forgot to enter what city your from!';
								}
							}
						?>
					</div>
					
					<div>
						<span style="float:left; width:150px; font-weight:bold;">State:</span>
						<input type="text" name="state" size="2" maxlength="2" value="<?php if (isset($_POST['state'])) echo $_POST['state']; ?>"/>
					</div>
					<div style="text-indent:150px; color:#CC3300; font-size:10px; height:20px;">
						<?php
							if (isset($_POST['submit'])) {
								if (strlen($_POST ['state']) > 0) {
									$state = TRUE;
								}else{
									$state = FALSE;
									echo'You forgot to enter what state your from!';
								}
							}
						?>
					</div>
					
					<div>
						<span style="float:left; width:150px; font-weight:bold;">Zipcode:</span>
						<input type="num" name="zipcode" size="5" maxlength="5" value="<?php if (isset($_POST['zipcode'])) echo $_POST['zipcode']; ?>"/>
					</div>
					<div style="text-indent:150px; color:#CC3300; font-size:10px; height:20px;">
						<?php
							if (isset($_POST['submit'])) {
								if (strlen($_POST ['zipcode']) > 0) {
									$zipcode = TRUE;
								}else{
									$zipcode = FALSE;
									echo'You forgot to enter your zipcode!';
								}
							}
						?>
					</div>
					<br />
					<div style="text-align:center; font-weight:bold; font-size:13px;">
						You must provide correct information<br />
						or your cash will not ship.
					</div>
					<br />
					<br />
					<br />
					<br />
                    <div align="center" style="color:#CC3300; font-size:13px;">Click "<span style="font-weight:bold;">Submit Shipping Info</span>" to Continue.</div>
                    <div align="center"><br /><input type="submit" name="submit" value="Submit Shipping Info" style="font-size:14px;" /></div>
                </fieldset>
            </form>
			<br />
			</div>
			<div style="background:#CCCCCC;"><span style="font-weight:bold; font-size:11px;">Please note:</span> <span style="font-style:italic; font-size:11px;">You MUST use true and valid information. ANY signups found to be using invalid information (false name, address, credit card, etc..) will be disqualified from this offer.</span>
			<br />
			<br />
			<span style=" font-size:11px;">You must be a US resident over 18 to participate. After submitting your order form, you will be taken to the offer page, where you must complete the required signup(s) from our partner advertisers. Your cash will ship within 24 hours of verification of your completion of the required advertiser signup(s).
			<br />
			<br />
			Accurate information must be provided to the partner advertisers. You may only complete each advertiser offer one time. Any false or intentionally deceptive information provided to the advertisers will result in forfeiture of your free cash. By clicking "Submit" you are agreeing to these terms and conditions.</span></div>
		</div>
    </div>
	<div class="footer">
		Copyright&copy; EasyMoney4YouOnline.com | <a href="termsofservice.html">Terms of Service</a>
	</div>
</div>
</body>
</html>