Can you set a timer in a php page?

Discussion in 'PHP' started by marieg, Sep 13, 2008.

  1. #1
    Is there a way to set a timer on a certain php page before redirecting to another page?

    Is this possible?
     
    marieg, Sep 13, 2008 IP
  2. live-cms_com

    live-cms_com Notable Member

    Messages:
    3,128
    Likes Received:
    112
    Best Answers:
    0
    Trophy Points:
    205
    Digital Goods:
    1
    #2
    You could echo a javascript redirect. Otherwise there's the PHP sleep function.
     
    live-cms_com, Sep 13, 2008 IP
  3. VisualMaster

    VisualMaster Guest

    Messages:
    59
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Red number is your timer - change it to 5 and it will redirect after 5 seconds :
     
    VisualMaster, Sep 13, 2008 IP
  4. marieg

    marieg Active Member

    Messages:
    695
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    58
    #4
    ok..

    I have another question..

    What if you want to show a text message after 2 seconds.. The text will show after 2 seconds?
     
    marieg, Sep 14, 2008 IP
  5. live-cms_com

    live-cms_com Notable Member

    Messages:
    3,128
    Likes Received:
    112
    Best Answers:
    0
    Trophy Points:
    205
    Digital Goods:
    1
    #5
    Javascript is best. Google javascript timer...

    Depends if you mean message-box or plain text on the page.
     
    live-cms_com, Sep 14, 2008 IP
  6. nabz245

    nabz245 Well-Known Member

    Messages:
    677
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    110
    #6
    You will need to use JavaScript. PHP is executed on the server side so all the delays will not show to the client (it will just be a delayed page load).

    JavaScript is a client side language which will allow the client to view all the changes and delays made by the code.


    I hope that helps!

    Regards
     
    nabz245, Sep 14, 2008 IP
  7. marieg

    marieg Active Member

    Messages:
    695
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    58
    #7
    Yes it help a lot!!.. Thank you!
     
    marieg, Sep 14, 2008 IP