i'm writing a redirect.php page for a CMS. the admin user makes whatever changes they want to certain information in the database, then clicks submit. they are taken to redirect.php which handles all the sql commands depending on what the admin wanted to change. and then they are redirected to another page, depending on the types of changes they made, as well... the header is not working. here's the error:
Warning: Cannot modify header information - headers already sent by (output started at /../../../admin/redirect.php) in /../../../admin/redirect.php on line 41
<?php
$uID = $_POST['editID'];
$sub_opt = $_POST['sub_opt'];
$brideFname = $_POST['brideFname'];
$brideLname = $_POST['brideLname'];
$groomFname = $_POST['groomFname'];
$groomLname = $_POST['groomLname'];
$ship_add = $_POST['ship_add'];
$ship_city = $_POST['ship_city'];
$ship_state = $_POST['ship_state'];
$ship_zip = $_POST['ship_zip'];
$_POST['event_month'];
$_POST['event_day'];
$_POST['event_year'];
if($_POST['event_month2'] != NULL){
$event_month = $_POST['event_month2'];
}if($_POST['event_day2'] != NULL){
$event_day = $_POST['event_day2'];
}if($_POST['event_year2'] != NULL){
$event_year = $_POST['event_year2'];
}
if($sub_opt == "cancel"){
echo "<CENTER>All changes were cancelled. You are being redirected to Home.</CENTER>";
$redirect = "admin1.php?action=view_all";
}elseif($sub_opt == "save"){
//open connection
//SQL commands
//close connection
echo "<CENTER>Your changes have been saved. You are being redirected to Home.";
$redirect = "admin1.php?action=view_all";
}elseif($sub_opt == "save_reg"){
//open connection
//same SQL commands
//close connection
echo "Your changes have been saved. You are being redirected to Registry.";
$redirect = "updateRegistry.php";
}
header("Location: $redirect");
?>