Click to See Complete Forum and Search --> : redirecting keeping post values
k0r54
02-18-2005, 03:26 PM
Hi,
when i use header("Location: blah.php") it doesn't keep the post variables?
How can i actually redirect keeping the post variables?
Thanks
k0r54
NogDog
02-18-2005, 03:55 PM
If I'm interpreting the comment on this page (http://us4.php.net/manual/en/function.header.php) correctly, this might be what you need:
header("HTTP/1.0 307 Temporary redirect");
header("Location: http://www.mydomain.com/otherlocation");
But I'm mostly guessing. Good luck.
k0r54
02-18-2005, 04:11 PM
Hi, ok im not sure???
This is what i am doing?
It does the checking of the form and THEN sends it to a page that enteres it into a db.
<?PHP
session_start();
require('php/validation.php');
include('php/db_config.php');
//split up the reg_code
$reg_code = explode(",", $reg_code);
$Type = $_GET[type];
// check to see if it should be validating or not
if (empty($_GET[val])){
$validate = false;
} else {
$validate = true;
}
if(isset($_POST) && is_array($_POST) && ($validate == true)) {
//validation via validation page
$error_msg = validate();
if($error_msg == ""){
//send to enter the data
header("Location: php/reg.php");
} else {
$errors = true;
}
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang='en'>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=ISO-8859-1'>
<title>Registration Page</title>
<link href="css/registration.css" rel="stylesheet" type="text/css">
</head>
<body>
<!-- Page Errors -->
<?php if(isset($errors) && $errors){ ?>
<?php echo $error_msg; } ?>
<form method="post" action="<?PHP echo $_SERVER['PHP_SELF']."?val=1"; ?>">
Thanks
k0r54
NogDog
02-18-2005, 10:15 PM
My idea is to change the header part to this:
//send to enter the data
header("HTTP/1.0 307 Temporary redirect"); // So POST data sent (maybe???)
header("Location: php/reg.php");
k0r54
02-19-2005, 03:42 AM
Yes, that has worked but unfortunatly it brings up a message asking if you want to be redirected the post data.
So im gonna just put the code into the page i think
Thanks though nogdog
k0r54