Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 08-07-2009
Member
 
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.
Reply With Quote
  #2  
Old 08-07-2009
Member
 
Join Date: May 2008
Posts: 2,383
Re: How to forward page using php

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

Quote:
<?
echo "<script language=\"javascript\">window.location=?
?>
__________________
The FIFA Manager 2009 PC Game
Reply With Quote
  #3  
Old 08-07-2009
Member
 
Join Date: Oct 2005
Posts: 2,389
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");
?>
Reply With Quote
  #4  
Old 08-07-2009
Member
 
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
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How to forward page using php"
Thread Thread Starter Forum Replies Last Post
IE 9 is displaying blank page and showing links as mouse hovered on the page Chitti's Technology & Internet 10 03-12-2011 10:31 AM
How can I get speed dial page as default page in Google Chrome v13 ? Shurod Technology & Internet 6 12-09-2011 10:47 PM
Getting ?Page cannot be displayed? error message while loading page on Internet Explorer 9 Nabhan Technology & Internet 9 26-08-2011 11:44 AM
Unable to retrieve page in kindle based on page numbers rUChIRr Portable Devices 6 08-07-2011 10:02 PM
Slow startup in IE9 - got blank page before it continues to home page Dalapathi Technology & Internet 3 17-02-2011 08:00 PM


All times are GMT +5.5. The time now is 01:17 AM.