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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

header("Location: bla.php"); alternative

Status
Not open for further replies.

curvv

IS-IT--Management
Jan 11, 2001
103
ZA
Hi,

Is there another way to redirect besides using header("Location: bla.php"); ??

My problem is that there's already output before the redirect. Therefor I cannot use 'header'.

thanx ######## CtN ########
 
Can use some simple javascript to do that.

<script language=&quot;javascript&quot;>
location.redirect(&quot;new.page&quot;);
</script>

Of course, that requires the browser to have javascript enabled. Most do anyway though.

Just curious, what output could you have before a redirect? Any shown text would only be visable for a very brief time.

-Nick
 
Yes, but it redirects to the same page.

Because of alot of changes I had to make to my code, it got a little jumbled up.

I have at the top of my time system script, code that tells the user if he is logged in or not. Now after a user logs in, it still says not logged in, because the login part of the code gets executed after the message. Only after something else is processed, it tells the user that he is logged in. So, I need to process the login and then reload the page to read the database again to register that user is logged in and display the message accordingly.

I know it is not the right way to do it, but I have a deadline.

thanx ######## CtN ########
 
<script language=&quot;javascript&quot;>
location.reload();
</script>

or

<script language=&quot;javascript&quot;>
location.redirect(&quot;samepage?different_var=value&quot;);
</script>
 
Or, to prevent the back button from loading the current page after the redirect, use:

<script language=&quot;javascript&quot;>
location.replace(&quot;samepage?different_var=value&quot;);
</script>

Chad. ICQ: 54380631
 
thanx ######## CtN ########
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top