Sending a user to a specified page with PHP

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
Exdaix
Forum Newbie
Posts: 5
Joined: Fri Feb 07, 2003 4:18 pm
Location: Near Philadelphia, PA, USA
Contact:

Sending a user to a specified page with PHP

Post by Exdaix »

I need to send a user to a certain page depending if they typed in the correct info in a Login box or not.

Here is the example code, it might help you with my question:

Code: Select all

// Check to see if they were accepted, if so send them to thier specified pages
if ($accepted == "True")
	{
		// Send to voting page
	}
else
	{
		// Send to Oops! page
	}
gdrums
Forum Newbie
Posts: 7
Joined: Mon Nov 18, 2002 4:41 pm

Post by gdrums »

I'm not sure if this is what you are looking for, but I've used...

Code: Select all

header("Location:index.php?fuseaction=home_page.news&page_id=2");
for sending a user to a specific page, kind of like a location tag.

User avatar
daven
Forum Contributor
Posts: 332
Joined: Tue Dec 17, 2002 1:29 pm
Location: Gaithersburg, MD
Contact:

Post by daven »

Code: Select all

<?php
// Check to see if they were accepted, if so send them to thier specified pages
if ($accepted == "True")
   { // url can be a variable (like I have here) or hard-coded.  It can also be relative or absolute.
       header("Location: ".$your_url_goes_here);
   }
else
   {
       header("Location: ".$your_url_goes_here);
   } 
?>
http://www.php.net/manual/en/function.header.php for more information
Exdaix
Forum Newbie
Posts: 5
Joined: Fri Feb 07, 2003 4:18 pm
Location: Near Philadelphia, PA, USA
Contact:

Post by Exdaix »

Great! Thanks.
Post Reply