How to redirect the user from one PHP Page to another?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
gopinathd
Forum Newbie
Posts: 8
Joined: Thu Nov 13, 2003 1:54 am

How to redirect the user from one PHP Page to another?

Post by gopinathd »

Hi all,

Like redirect() method in ASP, Is there any method available in PHP to
redirect the user from one PHP Page to another?

If so, Please tell me.

Thanks in advance.

Gopinath
Paddy
Forum Contributor
Posts: 244
Joined: Wed Jun 11, 2003 8:16 pm
Location: Hobart, Tas, Aussie
Contact:

Post by Paddy »

header("Location: somepage.php");

Note: It needs to be done before any html...
gopinathd
Forum Newbie
Posts: 8
Joined: Thu Nov 13, 2003 1:54 am

Post by gopinathd »

Hi paddy,

Thanks for replying.

We can't redirect the user from one page to another,If Something
is written in page.

Like response.clear() in ASP, Is there any method available here?

TIA

gopinath
Paddy
Forum Contributor
Posts: 244
Joined: Wed Jun 11, 2003 8:16 pm
Location: Hobart, Tas, Aussie
Contact:

Post by Paddy »

Not that I know of. Keep watching though. Someone will know. :)
What is it that you want to do?
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Post by infolock »

gopinathd, if you could be a little more descriptic on your needs, that would be great. have to understand, we have no idea what your project is doing. thanks :)
gopinathd
Forum Newbie
Posts: 8
Joined: Thu Nov 13, 2003 1:54 am

Post by gopinathd »

In login screen, After writing some text, I come to know that the user name entered is not a valid one. In such a case, I am not able to redirect the user to the previous page. B'cas I have already written some text.

In this case, I want to clear the text what i have written on the screen and redirect the user to the previous page.

Your immedidate reply will make me glad.

Thanks in advance.
Gopi
Paddy
Forum Contributor
Posts: 244
Joined: Wed Jun 11, 2003 8:16 pm
Location: Hobart, Tas, Aussie
Contact:

Post by Paddy »

Check if the user is a valid user prior to writing any text. I see no reason for you to write text if you are just going to redirect them anyway. Unless I am missing something?
gopinathd
Forum Newbie
Posts: 8
Joined: Thu Nov 13, 2003 1:54 am

Post by gopinathd »

Like Response.clear() method in ASP,
Is there any method for clearing the text displayed on the screen ?
Nay
Forum Regular
Posts: 951
Joined: Fri Jun 20, 2003 11:03 am
Location: Brisbane, Australia

Post by Nay »

viewtopic.php?t=1157

Read that...

-Nay
Paddy
Forum Contributor
Posts: 244
Joined: Wed Jun 11, 2003 8:16 pm
Location: Hobart, Tas, Aussie
Contact:

Post by Paddy »

You still haven't told us why you need the text prior to redirection.
Post Reply