I need to create a form where you have two possible finishing pages dependent on the answers you give in the form.

For instance if you have the question:

Do you like sweets?

And have the two possible outcomes

Yes or No

The answer yes takes you to a yesilikesweets.php or if you answer no when you hit submit
it takes you to noihatesweets.php

Any help greatly received.

<?php
// one way 
if($_POST['sweets']){
	if($_POST['sweets'] == "yes"){
		header( 'Location: ../ilikesweets.php' )
		
	}ELSE{
		header( 'Location: ../idontlikesweets.php' )
		
	}
}

echo "<form method=\"post\" target=\"_self\" >
do you like sweets</br>
<select name='sweets' size=\"1\">
	<option></option>
	<option value=\"yes\">yes</option>
	<option value=\"no\">no</option>
</select>
<input type=\"submit\" />
</form>"

?>


<?php
// another way
if($_POST['sweets']){
	if($_POST['sweets'] == "yes"){
	include "ilikesweets.php";
		
	}ELSE{
	include "idontlikesweets.php";
		
	}
}ELSE{

echo "<form method=\"post\" target=\"_self\" >
do you like sweets</br>
<select name='sweets' size=\"1\">
	<option></option>
	<option value=\"yes\">yes</option>
	<option value=\"no\">no</option>
</select>
<input type=\"submit\" />
</form>"
}

?>

Nice one!! I'll give that a go, thanks for your prompt reply!! Legend