I have the following function that inserts a record into a table. I want to be able to redirect the user to a page based on the Company Type. Right now it is only loading the first header no matter what the CompanyType is. Can someone take a look at this to see where I am going wrong? Thanks.
<?php
$editFormAction = $SERVER['PHP_SELF'];
if (isset($SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
?>
<?php
if ((isset($POST["MM_insert"])) && ($POST["MM_insert"] == "WAATKRegistrationForm")) {
$insertSQL = sprintf("INSERT INTO company (CompName, CompStreet1, CompStreet2, CompCity, CompState, CompZip, MailStreetAddress, MailCity, MailState, MailZipcode, CompPhone, CompFax, CompMobile, DERPhone, CompFirstName, CompLastName, CompEmail, CompUserName, CompPassword, CompMiddleINt, ActiveFlag, CompanyType) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($POST['CompName'], "text"),
GetSQLValueString($POST['CompStreet1'], "text"),
GetSQLValueString($POST['CompStreet2'], "text"),
GetSQLValueString($POST['CompCity'], "text"),
GetSQLValueString($POST['CompState'], "text"),
GetSQLValueString($POST['CompZip'], "text"),
GetSQLValueString($POST['MailStreetAddress'], "text"),
GetSQLValueString($POST['MailCity'], "text"),
GetSQLValueString($POST['MailState'], "text"),
GetSQLValueString($POST['MailZipcode'], "text"),
GetSQLValueString($POST['CompPhone'], "text"),
GetSQLValueString($POST['CompFax'], "text"),
GetSQLValueString($POST['CompMobile'], "text"),
GetSQLValueString($POST['DERPhone'], "text"),
GetSQLValueString($POST['CompFirstName'], "text"),
GetSQLValueString($POST['CompLastName'], "text"),
GetSQLValueString($POST['CompEmail'], "text"),
GetSQLValueString($POST['CompUserName'], "text"),
GetSQLValueString($POST['CompPassword'], "text"),
GetSQLValueString($POST['CompMiddleINt'], "text"),
GetSQLValueString($POST['ActiveFlag'], "text"),
GetSQLValueString($POST['CompanyType'], "text"));
mysql_select_db($database_dotweb, $dotweb);
$Result1 = mysql_query($insertSQL, $dotweb) or die(mysql_error());
if (!session_id()) session_start();
if(!isset($SESSION["CompId"]))
{
$SESSION["CompId"] = mysql_insert_id();
}
if($_POST['CompanyType'] == "Owner")
{
header("Location: productpaypal_owner.php");
}
else
{
header("Location: productpaypal_company.php");
}
}
?>