avo Posted May 28, 2006 Share Posted May 28, 2006 HI AllCan 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 dbmysql_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] Quote Link to comment https://forums.phpfreaks.com/topic/10659-solved-header-redirection/ Share on other sites More sharing options...
Barand Posted May 28, 2006 Share Posted May 28, 2006 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 Link to comment https://forums.phpfreaks.com/topic/10659-solved-header-redirection/#findComment-39783 Share on other sites More sharing options...
avo Posted May 28, 2006 Author Share Posted May 28, 2006 [!--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. Quote Link to comment https://forums.phpfreaks.com/topic/10659-solved-header-redirection/#findComment-39786 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.