Jump to content

Archived

This topic is now archived and is closed to further replies.

avo

*SOLVED* Header Redirection

Recommended Posts

HI All

Can anyone shed some light on this for me please as you can see from my code bellow there are three header redirect each doing redirection IF but i can not get the second redirection to work any ideas please it simply will not redirect .

[code]
<?     
include ('includes/dbconfig.php');

if ($_POST['del_no']){
header ('location: retrive_admin_message.php');
}


if($_GET["del_msg"] && $_GET["msgnumber"]==""){?>
<form id="form2" name="form2" method="Get" action="retrieve_admin_message.php">
  <input type="hidden" name="msg_no" />
</form><?
header ('location: retrive_admin_message.php');
exit ();
} else {

if ($_POST['del_yes']){
//connect to db
mysql_connect ($dbhost, $dbuser, $dbpass);
mysql_select_db ($dbname) or die ( mysql_error ());
$sql = "DELETE FROM user_messages WHERE id='".$_GET["msgnumber"]."'";
mysql_query($sql) or die (mysql_error ());
$deleted = '<span class="style9 style23">Message Deleted!</span>';
header ('location: retrive_admin_message.php');
}}[/code]

Share this post


Link to post
Share on other sites
Header() will not work if you have sent any output to the browser. You are sending form data before that second header.

Try

[code]if($_GET["del_msg"] && $_GET["msgnumber"]==""){?>
    $msg = $_GET["msgnumber"];
    header ("location: retrive_admin_message.php?name=$msg");
    exit ();
} else {[/code]

Share this post


Link to post
Share on other sites
[!--quoteo(post=377907:date=May 28 2006, 08:48 PM:name=Barand)--][div class=\'quotetop\']QUOTE(Barand @ May 28 2006, 08:48 PM) [snapback]377907[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Header() will not work if you have sent any output to the browser. You are sending form data before that second header.

Try

[code]if($_GET["del_msg"] && $_GET["msgnumber"]==""){?>
    $msg = $_GET["msgnumber"];
    header ("location: retrive_admin_message.php?name=$msg");
    exit ();
} else {[/code]
[/quote]

Thank you

I understand i can now work with that

cheers.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.