Problem With Page Redirect - Help me out with this problem...

free web hosting
Open Discussion > CONTRIBUTE > Computers > Programming Languages > PHP Programming

Problem With Page Redirect - Help me out with this problem...

ashish_m_k
hey ppl, i just wanted a little help...i designed this website, but i want that if i click on certain link, it should open new page for few seconds and then browser should automatically redirect me to some other page....i tried this with header() function but i couldnt do the wait n redirect part, ...

so somebody plz help....
-thanx in advance!

Notice from jlhaslip:

Thanks Avalon, topic changed.

Reply

Avalon
The simplest way to do this is to use a <META> tag in between the <HEAD> tags of your document. Here's an example...

CODE
<meta http-equiv="refresh" content="5;url=http://www.mysite.com/nextpage.html">

The value for 'content' is the time in seconds that want the original page to be displayed, the example shows 5 seconds. The value for 'url' is the page you want to redirect to.

Hope that helps.

[END NOTE] When posting your topics you should try to make your subject more descriptive. A better topic for this post would have been "Problem with page redirect, please help". Moderators can sometimes apply a warning for using a subject topic like the one you have used. Just some friendly advice. smile.gif

Reply

DeveloperX
I use Header php-function for redirection in me pages!

Code like
CODE

<meta http-equiv="refresh" content="5;url=http://www.mysite.com/nextpage.html">
can be stopped by Escape button pressing!!!

About php function - Header

The special case is the "Location:" header. Not only does it send this header back to the browser, but it also returns a REDIRECT (302) status code to the browser unless some 3xx status code has already been set.

CODE

<?php

header("Location: http://www.example.com/"); /* Redirect browser */

/* Make sure that code below does not get executed when we redirect. */
exit;
?>  



Note: HTTP/1.1 requires an absolute URI as argument to Location: including the scheme, hostname and absolute path, but some clients accept relative URIs.

You can usually use $_SERVER['HTTP_HOST'], $_SERVER['PHP_SELF'] and dirname() to make an absolute URI from a relative one yourself:

CODE


<?php
header("Location: http://" . $_SERVER['HTTP_HOST']
                    . rtrim(dirname($_SERVER['PHP_SELF']), '/\\')
                    . "/" . $relative_url);
?>  



Note: Session ID is not passed with Location header even if session.use_trans_sid is enabled.
It must by passed manually using SID constant.

View full description about Header function at http://php.rinet.ru/manual/ru/function.header.php with some examples.

 

 

 


Reply

Avalon
@DeveloperX
Does the header() function provide him with the delay he wants? He said he already tried using the header() function but couldn't get it to put a delay in before it redirected. Is there a delay type function in PHP that can be combined with the header() function, something like the javascript timeout() function perhaps? I don't know enough about PHP to answer that question.

Reply

DeveloperX
@Avalon

Guys! Please seeee my next source code example!
CODE

<?php

//For Ex. I want wait 2 seconds

$sec0=2;//delay
$sec1=date('s');//current server second
$sec2=-1;//for first cycle begin
while($sec2<$sec1+$sec0){$sec2=date('s');}

header("Location: http://www.example.com/"); /* Redirect browser */

exit;

?>  



You may check this script! Very cool! It's my coolest idea...

Reply

Avalon
QUOTE(DeveloperX @ Jan 10 2006, 09:38 PM)
You may check this script! Very cool! It's my coolest idea...
*


Very nicely done, that should solve his wait problem. I have to agree with you, it's simple and very cool. smile.gif

Reply

DeveloperX
QUOTE
Very nicely done, that should solve his wait problem. I have to agree with you, it's simple and very cool


One moment please,
You must check "MAX TIME EXECUTION" on your server php-configuration!
Usefully it equal 30 seconds!
But some hosting providers set this parameter for more 30 secs!!!

Reply

iGuest
I like the script since it works, but you need to be able to write to the document.
I'd like to be able to say

"Thanks for registering. Please wait while the page redirects you" or something.

-nate

[note=Approved by BH][/note]

Reply

iGuest
Protected Sub LinkBack_Click(ByVal sender As Object, ByVal e As System.EventArgs)
'Using Page parameters for Back Navigation

If Not Request.Params("ID") Is Nothing Then
Response.Redirect("ExpertsGallery.Aspx")
Else
'String url contains aspx page name from page parameter "URL"
Dim url As String = Request.QueryString("URL")
Response.Redirect(url.ToString())
End If
End Sub

In this code else block dosent work

-reply by Ratnesh Kumar

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.

Recent Queries:-
  1. internet explorer redirects back to original page - 5.07 hr back. (1)
  2. internet explorer search redirection problem - 5.07 hr back. (1)
  3. ie redirect to another session - 11.59 hr back. (1)
  4. php redirect internet explorer 7 - 16.43 hr back. (1)
  5. how to redirect page with delay in php - 19.70 hr back. (2)
  6. php, wait 5 seconds and redirect - 29.34 hr back. (1)
  7. aspx redirect url parameter - 37.31 hr back. (1)
  8. explorer redirect problem - 49.07 hr back. (1)
  9. ie php header redirect problem - 50.84 hr back. (1)
  10. ie php redirect problem - 51.29 hr back. (1)
  11. php ie header redirect problem - 51.53 hr back. (1)
  12. internet explorer redirect block - 55.88 hr back. (1)
  13. cool new page redirect - 56.55 hr back. (1)
  14. redirect .aspx web links in firefox - 58.66 hr back. (1)
Similar Topics

Keywords : problem, page, redirect, problem

  1. Http_redirect() [resolved]
    (5)
  2. Header Redirect Errors
    (5)
    Hi, I am using the header function to redirect after the processing of the form. I have to specify
    a internal link using '#link'. This works in Firefox and opera. But in Internet Explorer
    internal linking when done from a redirect is not working for somewhat reasons. e.g.
    header("Location: http://www.example.com/index.php#link"); this works in Firefox and Opera but
    not in Internet Explorer . IE just accepts 'http://www.example.com/index.php' instead of
    http://www.example.com/index.php#link Please help me if you know anything about this. Well ther....
  3. .htaccess Redirect Question
    redirect ALL traffic to another domain (6)
    I want to redirect all my traffic from one site to another domain name. Is this possible, and if so,
    would I do something like this: .htaccess code: CODE redirect 302 /
    http://www.mynewdomain.com Thanks!....
  4. Url Redirection
    redirect a page web to another page (7)
    Hi Is there some functions in php to redirect a page web to another page. thanks....

    1. Looking for problem, page, redirect, problem

*RANDOM STUFF*





*SIMILAR VIDEOS*
Searching Video's for problem, page, redirect, problem

*MORE FROM TRAP17.COM*
advertisement



Problem With Page Redirect - Help me out with this problem...



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute your information that might help someone here.
Ask your Doubts & Queries to get answers.. "Together, We enlight each other!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE