Transferring to a new page

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Waldyn@unisys

    Transferring to a new page

    Is there a command, or a way, to transfer to a different page using php. I
    currently am inserting JavaScript with a window.Open.



  • Chris Hope

    #2
    Re: Transferring to a new page

    Waldyn@unisys wrote:
    [color=blue]
    > Is there a command, or a way, to transfer to a different page using php. 
    > I currently am inserting JavaScript with a window.Open.[/color]

    You can redirect with

    header("Locatio n: http://www.domain.com/path/to/filename.html")

    but you can only do this if you don't intend to output anything from the
    script (and if you do the browser will redirect anyway and not render the
    stuff you send to it).

    If you want to go to a different page *after* the page has been rendered by
    the browser then you can only do it using javascript, if the user clicks a
    link or using the meta http-refresh tag eg

    <meta http-equiv="refresh" content="3;url= http://www.domain.com/">

    The number before the page to redirect to (3 in this example) is the number
    of seconds to wait before refreshing.

    --
    Chris Hope - The Electric Toolbox - http://www.electrictoolbox.com/

    Comment

    • Michael Vilain

      #3
      Re: Transferring to a new page

      In article <cia85o$2ms7$1@ si05.rsvl.unisy s.com>,
      "Waldyn@uni sys" <waldyn.benbene k@unisys.com> wrote:
      [color=blue]
      > Is there a command, or a way, to transfer to a different page using php. I
      > currently am inserting JavaScript with a window.Open.[/color]

      Define "transfer to a different page".

      Has the current page been displayed yet? If so, then create a link,
      which the user must click on to go to the next page. I don't know if
      this can be done non-interactively once the page has been displayed.
      Perhaps a Javascript with a timer handler might work.

      There's a "<META>" refresh tag in HTML which sends a refresh header. But
      it only works if the headers haven't already been sent to the browser.
      That's no a PHP issue. It's also not reliable for multiple browsers.
      Some browsers ignore it. Google for discussions that happen regularly
      on this issue (seems like it's once a week).

      --
      DeeDee, don't press that button! DeeDee! NO! Dee...



      Comment

      • AJ

        #4
        Re: Transferring to a new page


        "Chris Hope" <blackhole@elec trictoolbox.com > wrote in message
        news:yR12d.2829 $JQ4.229163@new s.xtra.co.nz...
        Waldyn@unisys wrote:
        [color=blue]
        > Is there a command, or a way, to transfer to a different page using php.
        > I currently am inserting JavaScript with a window.Open.[/color]

        You can redirect with

        header("Locatio n: http://www.domain.com/path/to/filename.html")

        but you can only do this if you don't intend to output anything from the
        script (and if you do the browser will redirect anyway and not render the
        stuff you send to it).

        Isn't it the other way round? I always thought that:

        echo "wibble";
        header("Locatio n: http://www.domain.com/path/to/filename.html")

        Would display wibble and ignore the redirect?


        Comment

        Working...