Page 1 of 1

Redirecting using a form

Posted: Fri Aug 10, 2007 9:59 am
by roondog
I have a simple form with a drop down menu to choose a page to go to.
the form then uses this

Code: Select all

<?php
if (isset($_POST['submitted'])) {
	if ($_POST['gallery'] == 'fashion') 
	{
		header ('Location:http://localhost/model/fashion.php');
	} 
	elseif ($_POST['gallery'] == 'glamour')
	{
		header ('Location:http://localhost/model/glamour.php');
	}
	elseif ($_POST['gallery'] == 'shows')
	{
		header ('Location:http://localhost/model/shows.php');
	}
	elseif ($_POST['gallery'] == 'tearsheets');
	{
		header ('Location:http://localhost/model/tearsheets.php');
	}
	
}
	?>
But nothing seems to be happening. Any suggestions please.

Posted: Fri Aug 10, 2007 10:38 am
by s.dot
Firstly, you need exit; calls after your header call.
Secondly, var_dump($_POST['submitted']); and var_dump($_POST['gallery']); to see if the values you are expecting are getting across.

Posted: Fri Aug 10, 2007 12:05 pm
by roondog
Thanks, it works now. I hadn't finished the form so it wasn't working.