Forum Moderators: coopster

Message Too Old, No Replies

redirect inside PHP code

         

web_server

7:43 pm on Apr 3, 2006 (gmt 0)



Hi there,
I want to make a redirect to $page2 after executing some PHP script In page1.php . the problem is that $page2 is a php variable so I
must include the redirect in my php code . I tried this :
/*********************************************************************************
print ("<meta http-equiv=Refresh content=5; URL=$page2.php>");
/********************************************************************************
but it didn't work .
any ideas?
Thank you.

sned

7:51 pm on Apr 3, 2006 (gmt 0)

10+ Year Member



You should be able to do this:

header("Location: $newurl");

See the header [us3.php.net] manual entry.

-sned

FourDegreez

8:15 pm on Apr 3, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I use:

header("HTTP/1.1 302 Found");
header("Location: $newurl");

On a new project, I've begun separating code to process form data from code to display the next page. The page processing the data redirects to the next page via the method above, and if the user hits refresh any POST data is not resubmitted (at least in IE).