PDA

View Full Version : Redirecting to another php page


Raman
01-30-2009, 03:25 AM
Looking for help with code logic

Trying to code logic in group.php file to check for value of a variable. If the variable is empty or not set then automatically redirect to another php page. Is it possible ?

Could some one help me here please

Dismounted
01-30-2009, 03:30 AM
What variable? It is possible, but you need to choose a hook where the variable would exist.

Raman
01-30-2009, 03:53 AM
First thanks for replying.

As new group is created, I would like to check the input code variable which is part of the URL as group.php?do=create&code=12345

Would like to check this code variable, if blank or not set redirect to starting php file

Dismounted
01-30-2009, 04:52 AM
Hook into that file as early as possible (probably group_start?), and redirect.

Raman
01-30-2009, 04:55 AM
Thanks for pointing the hook I should be using.

But I am looking for the exaxt syntax of redirect php code which I should be coding.

Regards

Dismounted
01-30-2009, 09:00 AM
Use the header() function to issue the redirect (and make sure you exit the script right after the header() call.

http://www.php.net/manual/en/function.header.php

Raman
01-30-2009, 03:07 PM
Thanks a million, You are great