header redirect not working

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
hame22
Forum Contributor
Posts: 214
Joined: Wed May 11, 2005 5:50 am

header redirect not working

Post by hame22 »

Hi I have the following script:

Code: Select all

if(empty($_POST['title']) ||  (empty($_POST['strap_line'])) || (empty($_POST['product_code'])) || (empty($_POST['pages'])) || ($_POST['category'] =="error") || ($_POST['manual'] == "error") || ($_POST['auth_name'] == "error") || (empty($_POST['url_path'])))
	{
		header('Location:page1.php?action=required');
	}	
	elseif(!is_numeric($_POST['pages']))
	{
		header("Location: page1.php?action=numeric");
	}
	else
	{	
	}
however the header(location ..) part of it does not redirect back appropriatley, the script works as when i substitue a error message this is displayed.


Any ideas why this could be the case?

thanks in advance
User avatar
Maugrim_The_Reaper
DevNet Master
Posts: 2704
Joined: Tue Nov 02, 2004 5:43 am
Location: Ireland

Post by Maugrim_The_Reaper »

Try using the full format:

header('Location: http://myserver.com/page.php?var=value');

With the full URI if possible. Is display_errors enabled in your PHP ini?
Post Reply