Hi guys just wondering if you can help me. I have a quiz i have to do for a webpage. The quiz consists of 10 qusetions and each question has 3 options, each option is then worth a numerical value and i need to add the total and output text. Below is the code I have written but obviously I am doing something wrong (with variables i think) as i'm getting an error message.
If anyone can give me some insight I would really appreciate it. Thanks.
Noreen.
<html>
<head>
<title>Your Wedding Invite</title>
</head>
<body>
<?
/*
require_once("quiz_fns.php");
do html_header("Quiz");
*/
$total = 0;
$question1 = 0;
$question2 = 0;
$question3 = 0;
$question4 = 0;
$question5 = 0;
$question6 = 0;
$question7 = 0;
$question8 = 0;
$question9 = 0;
$question10 = 0;
if($question1 = "1a")
{
$question1 = 2;
}
elseif($question1 = "1b")
{
$question1 = 0;
}
elseif($question1 = "1c")
{
$question1 = 1;
}
if($question2 = "2a")
{
$question = 1;
}
elseif($question2 = "2b")
{
$question2 = 2;
}
elseif($question2 = "2c")
{
$question2 = 0;
}
if($question3 = "3a")
{
$question3 = 2;
}
elseif($question3 = "3b")
{
$question3 = 1;
}
elseif($question3 = "3c")
{
$question3 = 0;
}
if($question4 = "4a")
{
$question4 = 2;
}
elseif($question4 = "4b")
{
$question4 = 1;
}
elseif($question4 = "4c")
{
$question4 = 0;
}
if($question5 = "5a")
{
$question5 = 1;
}
elseif($question5 = "5b")
{
$question5 = 2;
}
elseif($question5 = "5c")
{
$question5 = 0;
}
if($question6 = "6a")
{
$question6 = 2;
}
elseif($question6 = "6b")
{
$question6 = 1;
}
elseif($question6 = "6c")
{
$question6 = 0;
}
if($question7 = "7a")
{
$question7 = 2;
}
elseif($question7 = "7b")
{
$question7 = 0;
}
elseif($question7 = "7c")
{
$question7 = 1;
}
if($question8 = "8a")
{
$question8 = 2;
}
elseif($question8 = "8b")
{
$question8 = 0;
}
elseif($question8 = "8c")
{
$question8 = 1;
}
if($question9 = "9a")
{
$question9 = 2;
}
elseif($question9 = "9b")
{
$question9 = 0;
}
elseif($question9 = "9c")
{
$question9 = 1;
}
if($question10 = "10a")
{
$question10 = 2;
}
elseif($question10 = "10b")
{
$question10 = 1;
}
elseif($question10 = "10c")
{
$question10 = 0;
}
$total = $question1 + $question2 + $question3 + $question4 + $question5 + $question6 + $question7 + $question8 + $question9 + $question10;
echo "<p align='center'>";
echo "Your Score is:";
echo "$total";
if($total >= 16)
{
echo "<p align='center'>";
echo "Track-Making Mama";
echo "<br>";
echo "<br>";
echo "<br>";
echo "You'd rather be given a Brazilian wax one hair at a time than put down";
echo "<br>";
echo "relationship roots. Skittish at even the slightest overtures of obligation";
echo "<br>";
echo "you equate settling down with being shackled down, thus leaving you on";
echo "<br>";
echo "the run from long-term love. Your Escape from Alcatraz attitude can even";
echo "<br>";
echo "bleed over into your everyday decisions. But it's your one-on-one relationships" ;
echo "<br>";
echo "that suffer from your self-governing grumption. You've become so autonomous ";
echo "<br>";
echo "that you can't share your life without feeling a threat toward your independent ";
echo "<br>";
echo "spirit. So, how do you break free from your lone wolf instincts and catch up with";
echo "<br>";
echo "the pack?. You may want to seek therpy to help you figure out why you run from";
echo "<br>";
echo "relationships, or, try to step outside yourself and observe your own actions.";
echo "<br>";
echo "The first step is finding out what's behind your Born Free mentality. Once you";
echo "<br>";
echo "get a handle on your 'Party of One' persona, you'll be able to deal with your";
echo "<br>";
echo "commitment fears as they arise, and be that much closer to setting a table";
echo "<br>";
echo "for two!";
}
elseif($total >= 8 && $total <= 15)
{
echo "<p align='center'>";
echo "Borderline Bolter";
echo "<br>";
echo "<br>";
echo "<br>";
echo "Although not nearly as phobic as the track-happy chick, you've been known to";
echo "<br>";
echo "pull a Houdini when things get heavy. You see commitment as a threat rather";
echo "<br>";
echo "than the next step in a blossoming relationship, leaving you to question the";
echo "<br>";
echo "intentions of any man who wants to go beyond your first name. You may have had";
echo "<br>";
echo "a bad experience in the past that soured you on settling down, but that doesn't" ;
echo "<br>";
echo "mean that you have to be single forever. Stop making yourself feel as if you're";
echo "<br>";
echo "under the gun. Let others get panicked - you take all the time you need to get";
echo "<br>";
echo "the right fit. Strong individualism may make you even more magnetic to your man";
echo "<br>";
echo "of the moment, but the key to halting those hit-the-trail tendencies is to learn";
echo "<br>";
echo "that sharing your life doesn't necessarily mean losing it. You can enjoy all the";
echo "<br>";
echo "good parts of a realationship and still be your own person and have your own space.";
echo "<br>";
echo "And if you never give anyone a chance you may find out you miss on your soul mate.";
}
elseif($total <= 7)
{
echo "<p align='center'>";
echo "Commitment-Cool Chick";
echo "<br>";
echo "<br>";
echo "<br>";
echo "You're not one to shy away from a good thing. Rather than running scared from";
echo "<br>";
echo "Mr Right you view commitment as a coup, all the while knowing when to set up";
echo "<br>";
echo "camp - and when to pact it in. You probably had a very trusting relationship";
echo "<br>";
echo "with parents who nutured your independence and self-expression with love and";
echo "<br>";
echo "support." ;
echo "<br>";
echo "As a result you don't feel the need to run to show that you are your own woman.";
echo "<br>";
echo "You know you can trust in yourself to make the best decisions for your life so";
echo "<br>";
echo "you're free to love without the flight factor. Just be sure to keep that";
echo "<br>";
echo "trail-blazing under control and you'll likely never risk choking on your own dust!";
}
?>
</body>
</html>
:eek: