Reputation: 6305
I have page register.php, which is used to get user informations, after completion of form, it submits to an-other page, post.php.
post.php performs two actions, it adds incoming data to 2 locations in order, 1.php and 2.php, so the flow of data is
register.php -->post.php --> 1.php -->2.php -->register.php?value='abc'
once data is sent to both the locations, again register.php is loaded but this time page apears in browser like
http://www.example.com/register.php?value='abc'
how can i redirect this page to welcome.php? the new flow will be
register.php -->post.php --> 1.php -->2.php -->register.php?value='abc' -->welcome.php
as for as such a strange flow is concerned, that quite learning things, and there is no problem with it, i am caught at the last step, when i have to redirect the page to welcome.php..
how can I do it?
Upvotes: 1
Views: 672
Reputation: 3463
This might be what you want
if(str_pos($_SERVER['HTTP_REFERER'],"2.php") > 0){
header( 'Location: welcome.php', true,301);
}
Hope it helps
Upvotes: 1
Reputation: 36
Why dont you use a session variable instead of using GET on the register.php page?
if(isset($_SESSION['value']){
header('Location:');
}
Upvotes: 2
Reputation: 20997
You have several options, using header()
with Location:
(one of examples in manual):
header( 'Location: welcome.php');
// Or with all parameters:
header( 'Location: welcome.php', true, 301);
Or meta redirect:
<meta http-equiv="refresh" content="0; url=http://example.com/">
window.location.href = 'welcome.php'
Upvotes: 1