PHP jump to other page

stude.list at googlemail.com stude.list at googlemail.com
Wed Oct 4 18:33:18 UTC 2006


Hi

On 04/10/06, Groundhog <linuxmurah at gmail.com> wrote:
> how can I jump to another page after IF..ELSE statement, for example:

Issue a redirect header to the browser, you proabably want a 302
redirect, use the header function. And because the guys at PHP are so
good, you needn't send a 302 as the location header will do that
automatically.

Read the example at: http://uk.php.net/manual/en/function.header.php
to use your example:
if (statement) { /* stay here */ }
else
{
  header("Location: http://www.example.com/index2.php");
  exit;
}
(code untested)
(note URL should be absolute NOT relative!)

-- Andy




More information about the ubuntu-users mailing list