After a long day of coding, I produced a rather complex if statement, but I am having a problem. Here is how it works:
There is an html form with radio button selection. Then, on the next page, it runs if statements for every possible combination of choices to award the person the appropriate wand. So here is my problem, no matter what options I choose, I always get the first option listed, which says
Code: Select all
Olivander notes all of your answers and finally looks up at you and says <i>"Ah, yes, it seems that I know just the wand for you. Here it is, a <font color='red'>10" Hawthorn Wand with a Unicorn Hair core</font>. You know, Draco Malfoy has this very same wand!"</i>";Code: Select all
<html>
<head>
<title>Weasleys' Wizard Wheezes</title>
</head>
<body>
<link rel="stylesheet" href="style.css" type="text/css" />
<div id="index" align="center">
<?php
include_once 'connect.php';
session_start();
include_once 'logo.php';
?>
<link href="style.css" rel="stylesheet" type="text/css" />
<div id="login2" div align="center">
<?php
if (isset($_SESSION['player']))
{
$player=$_SESSION['player'];
}
else
{
echo "Not Logged in <br><br> <A href='home.php'>Login</a>";
exit;
}
?>
</div>
<?php
$playerinfo="SELECT * from players where name='$player'";
$playerinfo2=mysql_query($playerinfo) or die("could not get player stats!");
$playerinfo3=mysql_fetch_array($playerinfo2);
?>
<div align:center; width:60%;>
<br><br><br><br>
<form method="GET" action="wandselect.php">
<b>Question 1:</b>
<br><br>
How would you describe yourself?<br><br>
Selfish:<input type="radio" value="Selfish" name="Describe"><br>
Brave:<input type="radio" value="Brave" name="Describe"><br><br>
<b>Question 2:</b>
<br><br>
What would you do if your friend was being tortured by a Death Eater?<br><br>
Join in with the Death Eater and have a good laugh about it:<input type="radio" value="Join in with the Death Eater and have a good laugh about it" name="Help"><br>
Defend your friend and tell off the Death Eater:<input type="radio" value="Defend your friend and tell off the Death Eater" name="Help"><br><br>
<b>Question 3:</b>
<br><br>
Which creature do you find most interesting?<br><br>
Unicorn:<input type="radio" value="Unicorn" name="Core"><br>
Dragon:<input type="radio" value="Dragon" name="Core"><br>
<br><br>
<input type="submit" value="Claim your wand!" name="submit"></form>
</div>
</body>
</html>
Code: Select all
<html>
<head>
<title></title>
</head>
<body>
<link rel="stylesheet" href="style.css" type="text/css" />
<div id="index" align="center">
<?php
include_once 'connect.php';
session_start();
include_once 'logo.php';
?>
<link href="style.css" rel="stylesheet" type="text/css" />
<div id="login2" div align="center">
<?php
if (isset($_SESSION['player']))
{
$player=$_SESSION['player'];
}
else
{
echo "Not Logged in <br><br> <A href='home.php'>Login</a>";
exit;
}
?>
</div>
<?php
$playerinfo="SELECT * from players where name='$player'";
$playerinfo2=mysql_query($playerinfo) or die("could not get player stats!");
$playerinfo3=mysql_fetch_array($playerinfo2);
$describe=$_GET['Describe'];
$help=$_GET['Help'];
$core=$_GET['Core'];
if ($describe="Selfish"){
if ($help="Join in with the Death Eater and have a good laugh about it"){
if ($core="Unicorn"){
echo "Olivander notes all of your answers and finally looks up at you and says <i>"Ah, yes, it seems that I know just the wand for you. Here it is, a <font color='red'>10" Hawthorn Wand with a Unicorn Hair core</font>. You know, Draco Malfoy has this very same wand!"</i>";
}
else{
echo "Olivander notes all of your answers and finally looks up at you and says <i>"Ah, yes, it seems that I know just the wand for you. Here it is, a <font color='red'>12 3/4" Walnut Wand with a Dragon Heartstring core</font>. You know, Bellatrix Lestrange has this very same wand!"</i>";
}
}
else{
if ($core="Unicorn"){
echo "Olivander notes all of your answers and finally looks up at you and says <i>"Ah, yes, it seems that I know just the wand for you. Here it is, a <font color='red'>12 1/4" Ash Wand with a Unicorn Hair core</font>. You know, Cedric Diggory has this very same wand!"</i>";
}
else{
echo "Olivander notes all of your answers and finally looks up at you and says <i>"Ah, yes, it seems that I know just the wand for you. Here it is, a <font color='red'>10 1/4" Hornbeam Wand with a Dragon Heartstring core</font>. You know, Victor Krum has this very same wand!"</i>";
}
}
}
else{
if ($help="Join in with the Death Eater and have a good laugh about it"){
if ($core="Unicorn"){
echo "Olivander notes all of your answers and finally looks up at you and says <i>"Ah, yes, it seems that I know just the wand for you. Here it is, a <font color='red'>10 3/4" Oak Wand with a Unicorn Hair core</font>. You know, Narcissa Malfoy has this very same wand!"</i>";
}
else{
echo "Olivander notes all of your answers and finally looks up at you and says <i>"Ah, yes, it seems that I know just the wand for you. Here it is, an <font color='red'>18" Elm Wand with a Dragon Heartstring core</font>. You know, Lucius Malfoy has this very same wand!"</i>";
}
}
else{
if ($core="Unicorn"){
echo "Olivander notes all of your answers and finally looks up at you and says <i>"Ah, yes, it seems that I know just the wand for you. Here it is, a <font color='red'>14" Willow Wand with a Unicorn Hair core</font>. You know, Ron Weasley has this very same wand!"</i>";
}
else{
echo "Olivander notes all of your answers and finally looks up at you and says <i>"Ah, yes, it seems that I know just the wand for you. Here it is, a <font color='red'>10 3/4" Vine Wand with a Dragon Heartstring core</font>. You know, Hermione Granger has this very same wand!"</i>";
}
}
}
?>