Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

really quick help....redirect

Status
Not open for further replies.

gwu

MIS
Dec 18, 2002
239
US
I am new to php and need the code to auomatically redirect to another web page. I cant seem to find any examples. In ASP the core was:


<% response.redirect &quot;index2.html&quot; %>


thanks
 
what skiflyer said, however there is a bug with these boards which will invalidate his code.
whenever you put a url in code it appends a ; .
remove the first one after the url, but keep the last one. ______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
Oop, he's right... the board has a workaround, I just always forget to use it...

Code:
header(&quot;Location: [URL unfurl="true"]http://www.example.com/&quot;);[/URL]

-Rob
 
what workaround?

c'mon, share - you know its the right thing to do :) ______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
Use the
Code:
 and
TGML tags and remember to check the &quot;Process TGML&quot; option. //Daniel
 
you say that all headers must be sent before anything else? Can someone explain further. I read the same thing on php.net but still confused.
what if i want to send people to different places depending on a variable like:
****************
x=session(&quot;variable&quot;);
if x =1 then
header(&quot;Location: else
header(&quot;Location: ****************
thanks
 
gwu
Sure, it's output to the browser that's a concern here.

What you put will work, but a print statement before a header command, or including a file which echos something would not. Additionally, a mistake a hear of once and awhile is blank spaces before the opening <?php tag, which is sent to the browser to print blank space.



likelylad
That will only work for people with javascript turned on in their browser... that may or may not be a concern for you.

-Rob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top