Jump to content

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]
Link to comment
https://forums.phpfreaks.com/topic/10659-solved-header-redirection/
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]
[!--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.
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.