Results 1 to 4 of 4

Thread: How to forward page using php

  1. #1
    Join Date
    Dec 2008
    Posts
    39

    How to forward page using php

    How to set a page forward to another automatically? I'm making form using php which sends the result to another page say result.php , i want result to display on another page by automatically forward the user's browser to another page. How can i achieve this? Thanks for any help.

  2. #2
    Join Date
    May 2008
    Posts
    2,389

    Re: How to forward page using php

    I think you'll need to add the following script line to forward:

    <?
    echo "<script language=\"javascript\">window.location=…
    ?>

  3. #3
    Join Date
    Oct 2005
    Posts
    2,393

    Re: How to forward page using php

    Often, forwarding web pages is done with .htaccess. But sometimes you don't want to mess with editing .htaccess (or you may not have access to it). You can do HTML forwarding, but PHP allows you to use a more transparent method (and you'd like to retain referrer information). Just edit the code below and add it to the page in question.

    Code:
    <?php
      header("Location: http://domain.tld/page.php");
    ?>

  4. #4
    Join Date
    Nov 2005
    Posts
    1,323

    Re: How to forward page using php

    Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP. It is a very common error to read code with include(), or require(), functions, or another file access function, and have spaces or empty lines that are output before header() is called. The same problem exists when using a single PHP/HTML file.

    Code:
    <html>
    <?php
    /* This will give an error. Note the output
     * above, which is before the header() call */
    header('Location: http://www.example.com/');
    ?>
    Source: http://in2.php.net/manual/en/function.header.php

Similar Threads

  1. Replies: 10
    Last Post: 03-12-2011, 10:31 AM
  2. Replies: 6
    Last Post: 12-09-2011, 10:47 PM
  3. Replies: 9
    Last Post: 26-08-2011, 11:44 AM
  4. Unable to retrieve page in kindle based on page numbers
    By rUChIRr in forum Portable Devices
    Replies: 6
    Last Post: 08-07-2011, 10:02 PM
  5. Slow startup in IE9 - got blank page before it continues to home page
    By Dalapathi in forum Technology & Internet
    Replies: 3
    Last Post: 17-02-2011, 08:00 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,989,154.83106 seconds with 16 queries