Code: Select all
header('Location: '. $page);
exit();Moderator: General Moderators
Code: Select all
header('Location: '. $page);
exit();Code: Select all
<form method="find_plan.php" action="post">
Pet Type:
<label><input name="breed" value="cat" type="radio" />Cat</label>
<label><input name="breed" value="dog" type="radio" />Dog</label>
<br />
Age Range:
<label><input name="age" value="under8" type="radio" />Under 8</label>
<label><input name="age" value="over8" type="radio" />Over 8</label>
<br />
<input type=submit name=submit value="Submit">
</form>I'm really sorry - I am so new to php that I don't understand what you mean.Jcart wrote:Are you doing anything with the $page variable? i.e.
Code: Select all
header('Location: '. $page); exit();
Code: Select all
<form method="find_plan.php" action="post">
Pet Type:
<label><input name="breed" value="cat" type="radio" />Cat</label>
<label><input name="breed" value="dog" type="radio" />Dog</label>
<br />
Age Range:
<label><input name="age" value="under8" type="radio" />Under 8</label>
<label><input name="age" value="over8" type="radio" />Over 8</label>
<br />
<input type=submit name=submit value="Submit">
</form>Code: Select all
<?php
if (isset($_POST['breed']) && isset($_POST['age'])) { //make sure values exist before using them
if ($_POST['breed'] == 'dog') {
if ($_POST['age'] == 'under8') {
$page = 'http://www.google.co.uk';
} else {
$page = 'http://www.yahoo.co.uk';
}
} else {
if ($_POST['breed'] == 'cat') {
if ($_POST['age'] == 'under8') {
$page = 'http://www.msn.co.uk';
} else {
$page = 'http://www.bbc.co.uk';
}
}
echo $page;
header('Location: '. $page);
exit();
}
?>tazdevil wrote:Just found another thing...
Because of the above error, I added another } curly bracket to the end of the code.
I now get the following:
http://www.bbc.co.uk
Warning: Cannot modify header information - headers already sent by (output started at /home/fastnet/public_html/fastnetria/find_plan.php:1) in /home/fastnet/public_html/fastnetria/find_plan.php on line 19
Code: Select all
echo $page;
header('Location: '. $page);
exit();Code: Select all
echo $page;Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form method="post" action="find_plan.php">
<!--<form method="find_plan.php" action="post">-->
Pet Type:
<label><input name="breed" value="cat" type="radio" />Cat</label>
<label><input name="breed" value="dog" type="radio" />Dog</label>
<br />
Age Range:
<label><input name="age" value="under8" type="radio" />Under 8</label>
<label><input name="age" value="over8" type="radio" />Over 8</label>
<br />
<input type=submit name=submit value="Submit">
</form>
</body>
</html>Code: Select all
<?php
if (isset($_POST['breed']) && isset($_POST['age'])) { //make sure values exist before using them
if ($_POST['breed'] == 'dog') {
if ($_POST['age'] == 'under8') {
$page = 'http://www.google.co.uk';
} else {
$page = 'http://www.yahoo.co.uk';
}
} else {
if ($_POST['breed'] == 'cat') {
if ($_POST['age'] == 'under8') {
$page = 'http://www.msn.co.uk';
} else {
$page = 'http://www.bbc.co.uk';
}
}
header('Location: '. $page);
exit();
}
?>Code: Select all
echo $page;Code: Select all
<?php
if (isset($_POST['breed']) && isset($_POST['age'])) { //make sure values exist before using them
if ($_POST['breed'] == 'dog') {
if ($_POST['age'] == 'under8') {
$page = 'http://www.google.co.uk';
} else {
$page = 'http://www.yahoo.co.uk';
}
} else {
if ($_POST['breed'] == 'cat') {
if ($_POST['age'] == 'under8') {
$page = 'http://www.msn.co.uk';
} else {
$page = 'http://www.bbc.co.uk';
}
}
header('Location: '. $page);
exit();
}
}
?>
I admit I held your hand a little because I realized you were new to PHP.. but you need to learn to fix these kinds of errors on your own. To help you, take a look at our editors thread for an editor that can match the brackets and highlight parse errors in real time.tazdevil wrote: I've taken away theand get the following error, rather than transferring me to one of the $page url's...Code: Select all
echo $page;
Parse error: syntax error, unexpected $end in /home/fastnet/public_html/fastnetria/find_plan.php on line 20
Any guidance, help or correction of the code would be really appreciated.
Does the above work on your system?
many thanks