tazdevil wrote:You're missing the closing curly bracket for your ifelse statement on line 11.
Sorry to be a pain... I don't know where to place this bracket on line 11 - please can you show me.
Dude, don't worry about it all! I probably shouldn't even be trying to help, since I'm a beginner, too. I don't want to step on the toes of the "big guys" around here

.
Here's what I come up with:
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 = 'page_url_1';
} else {
$page = 'page_url_2';
}
} else {
if ($_POST['breed'] == 'cat') {
if ($_POST['age'] == 'under8') {
$page = 'page_url_3';
} else {
$page = 'page_url_4';
}
}
}
?>
Also, to explain my first reply above, here's how I would do this as a beginner, instead of using the multiple if/else conditionals. However, use the one you are already working on, just incase somebody comes in here and tells me I don't know what I'm talking about :
Code: Select all
<?php
if (isset($_POST['submit'])); {
if (isset($_POST['cat'] && $_POST['under8'])) {
$page = 'page_url_1';
}
if (isset($_POST['cat'] && $_POST['over8'])) {
$page = 'page_url_2';
}
if (isset($_POST['dog'] && $_POST['under8'])) {
$page = 'page_url_3';
}
if (isset($_POST['dog'] && $_POST['over8'])) {
$page = 'page_url_4';
}
}
?>
<form method="this file.php" action="post">
Pet Type:
<label><input type="radio" name="cat" value="cat" />Cat<label>
<label><input type="radio" name="dog" value="dog" />Dog</label>
Age Range:
<label><input type="radio" name="under8" value="under8" />Under 8</label>
<label><input type="radio" name="over8" value="over8" />Over 8</label>
<input type="submit" name="submit" value="Submit">
</form>
IMO, my way uses less code, and that's what I'm trying to achieve as I teach myself the language.