View Full Version : What is equivalent of forward or redirect in PHP
FlashNewby
January 1st, 2005, 12:35 PM
Would like to know what is the equivalent of redirect or forward method in PHP. In coding jsp's you can use either to pass the request to another page. Their has to be some equivalent. Example in jps you do something like this: response.redirect or response.forward("test.html");
I need to be able to forward requests using php.
Thanks
λ
January 1st, 2005, 12:46 PM
header ("Content-Location:myfile.html");
FlashNewby
January 1st, 2005, 03:12 PM
Can you give me a code example?
RushScripting
January 1st, 2005, 08:26 PM
I like to echo the meta tag redirects in html
<meta http-equiv='refresh' content='0; url="blah.com"' />
FlashNewby
January 1st, 2005, 09:22 PM
Thanks RushScripting, can you give me an example of some code not in a meta tag
Thanks
RushScripting
January 1st, 2005, 09:27 PM
Not sure what you mean really :P If you are only wanting to use php and no html then I suggest you use λ's way. I also noticed that you live within an hour of me (I live in Fort Worth :P).
FlashNewby
January 1st, 2005, 09:43 PM
Cool! It's nice to know their are kirupa lovers nearby. Actually I'll be using it with HTML, I did manage to find another thread that showed me what I was looking for.
Happy new year in Fort Worth.
Kristopher
January 28th, 2005, 02:23 PM
I need to use this trick too. See once I do a mail form and the user hits submit, I want to redirect to a thank you page. That possible?
Kristopher
January 28th, 2005, 02:49 PM
Nevermind, I figured it out on my own.
http://www.phpfreaks.com/quickcode/Redirecting_the_Web_Browser_with_PHP/14.php
Ben H
January 28th, 2005, 03:58 PM
I would use this:
<?php
Header ("Location: http://your-url.com/pagetoredirectto.html");
?>
ahmed
January 28th, 2005, 04:00 PM
I would use om3ga's too. It's the proper way of forwarding right off the server :)
FlashNewby
January 29th, 2005, 06:29 PM
Cool I will do this.
Thanks guys
T-O
January 29th, 2005, 08:18 PM
<?php
echo "
<script language=\"javascript\">
<!--
location.replace(\"http://www.kirupa.com\");
-->
</script>";
?>
works as well.
<?php
function redirect($url)
{
echo "
<script language=\"javascript\">
<!--
location.replace(\"$url\");
-->
</script>";
}
redirect("http://www.kirupa.com");
?>
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.