Hi guys heres the thing... I have a form that inserts info into the db, and after the insertion is finished I would like to redirect the user to another page.
Im using headers... but has far as I read it says for me to use raw urls.. which I tried ( I think I might have tried so many I ran out of possible combinations :p ).
I have the following URLs:
This is the URL where the user will insert the informations on the form:
http://localhost/rgreenroom/main.php?page=Production&prod=CreateProduction
after clicking submit, I would like to redirect him to:
http://localhost/rgreenroom/main.php?page=Production&prod=EditProduction
ob_start(); // on the begining of the page
//A few lines down, the header code
$insertGoTo = "main.php?page=Production&prod=EditProduction";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
ob_flush();// at the bottom of the page
The Problem is instead of getting right the new URL (main.php?page=Production&prod=EditProduction) it actually concatenates the new URL if the old:
http://localhost/rgreenroom/main.php?page=Production&prod=EditProduction&page=Production&prod=CreateProduction
I tried using the raw URL on the header location... but the same thing happens.
Can you guys help me with this pleeeeease?
I do not know if thats thebest way to redirect.. if theres better waa to do his I would appreciate very much for a tip!
Thank you.