Header
Just started learning php and am in the process of doing a tutorial. If I wanted to redirect a user to page B as soon as they arrived at page A would I use the following code:
<?php
header( "Location:<a href="http://www.someurl.com" class="bb-url">http://www.someurl.com</a>");
exit;
?>
Renegade posted this at 01:46 — 12th October 2003.
He has: 3,022 posts
Joined: Oct 2002
yes you would.
Khanny posted this at 08:21 — 12th October 2003.
They have: 51 posts
Joined: Dec 2002
cheers
m3rajk posted this at 16:42 — 12th October 2003.
They have: 461 posts
Joined: Jul 2003
fyi: if you want to have a delay you need to use the html meta tag, and if you want to be able to vary on some things (like e i have) you will need a page creation function of your own that takes a url and time. (like i did) and if you wanna add other things you can put them thre too. mine for redirection takes three arguments: title, url, delay
POSIX. because a stable os that doesn't have memory leaks and isn't buggy is always good.
Khanny posted this at 01:26 — 16th October 2003.
They have: 51 posts
Joined: Dec 2002
I read somewhere that with the code I mentioned above you can only use it at the very beginning of the script, it won't work if it's further down, that true?
Is there any other way to do a redirect other than that which I mentioned?
Suzanne posted this at 01:44 — 16th October 2003.
She has: 5,507 posts
Joined: Feb 2000
yes and no -- you can use that anywhere in the script if you're exiting right afterwards. Thing is, if the headers are already sent (page is loading), you can't send MORE headers, so if you want it in the same page, no can do, it must be first.
Why do you want to redirect? That may help people give you specific and helpful advice instead of just guessing at it.
Mark Hensler posted this at 03:42 — 16th October 2003.
He has: 4,048 posts
Joined: Aug 2000
<script language="javascript" type="text/javascript">
<!--
self.location='index.html';
//-->
</script>
Mark Hensler
If there is no answer on Google, then there is no question.
Khanny posted this at 04:41 — 16th October 2003.
They have: 51 posts
Joined: Dec 2002
no particlar reason, I just wanted to know if there were other ways of redirecting
cheers
m3rajk posted this at 14:13 — 16th October 2003.
They have: 461 posts
Joined: Jul 2003
change the numbe (0) to however many seconds you want. 0 is immediate (same as headers function)
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.