Solved

Redirect to another page

Posted on 2004-08-05
3
2,196 Views
Last Modified: 2008-03-10
I have a php page that does some things, but prints nothing.  I would like to add a statement at the end that redirects to another page.  I can do this in asp, but don't know how to do it in php.
Thanks.
0
Comment
Question by:donb1
  • 3
3 Comments
 
LVL 27

Accepted Solution

by:
Diablo84 earned 125 total points
ID: 11731802
header("location: page.php");
exit;
0
 
LVL 27

Expert Comment

by:Diablo84
ID: 11731811
you should technically use absolute pths (ie. a full url or the path from the root) although all browsers to my knowledge support relative paths (ie. the others files location relative from where the current file is).

exit; is not essential but ensures that no other code is processed after the header redirect.

The code must go before any out put including html, php (echo/print) and in some cases new lines and spaces

Diablo
0
 
LVL 27

Expert Comment

by:Diablo84
ID: 11731813
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
PHP website on Linux - server DNS address could not be found. 18 77
Make login page safer 3 30
Change a button after e-mail 4 19
php mysql pdo 13 30
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
These days socially coordinated efforts have turned into a critical requirement for enterprises.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question