page redirect

Discussion in 'PHP' started by harry1, Jun 15, 2009.

  1. #1
    how can i print message while redirection of header (page redirect) that your page has been redirect successfully or anything else such as one (blog name)has been update successfully?
     
    harry1, Jun 15, 2009 IP
  2. matt_fawcett

    matt_fawcett Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    If your doing a redirect by sending it in the headers then you can't show a message first because a redirect response can not have a body as well.

    What you may want to do is show a normal page and have a meta refresh on the page that will redirect after a number of seconds, so you can display a message to the user in that time.
     
    matt_fawcett, Jun 15, 2009 IP
  3. harry1

    harry1 Peon

    Messages:
    70
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    thanks what how can i do that all?
     
    harry1, Jun 15, 2009 IP
  4. matt_fawcett

    matt_fawcett Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    On http://yoursite.com/page1 display a normal page with your message on saying that the user will be redirected in 2 seconds. Also include the following tag inbetween the <head> tags of your html.
    
    <meta http-equiv="refresh" content="2;url=http://yoursite.com/page2">
    
    Code (markup):
     
    matt_fawcett, Jun 15, 2009 IP
  5. harry1

    harry1 Peon

    Messages:
    70
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    but i want page redirect on the special events?
     
    harry1, Jun 15, 2009 IP
  6. SHOwnsYou

    SHOwnsYou Peon

    Messages:
    209
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #6
    put ob_start(); at the beginning of your page and ob_flush(); at the end.
     
    SHOwnsYou, Jun 15, 2009 IP
  7. matt_fawcett

    matt_fawcett Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    You will need to replace the url I listed with your own.
     
    matt_fawcett, Jun 15, 2009 IP