Markpyro
04-28-2005, 7:52 PM
<?php
if (isset($_POST['question1']) && isset($_POST['question2']) && isset($_POST['question3']) && isset($_Post['question4'])
{
echo "You filled in all the questions.<br>\n";
if ($_POST['question1'] == "a")
{
$score++;
echo "You have answered question one correctly.<br>\n";
}
else
{
echo "You have not answered question one correctly.<br>\n";
}
if ($_POST['question2'] == "b")
{
$score++;
echo "You have answered question two correctly.<br>\n";
}
else
{
echo "You have not answered question two correctly.<br>\n";
}
if ($_POST['question3'] == "b")
{
$score++;
echo "You have answered question three correctly.<br>\n";
}
else
{
echo "You have not answered question three correctly.<br>\n";
}
if ($_POST['question4'] == "c")
{
$score++;
echo "You have answered question four correctly.<br>\n";
}
else
{
echo "You have not answered question four correctly.<br>\n";
}
if ($_POST['question5'] == "b")
{
$score++;
echo "You have answered question five correctly.<br>\n";
}
else
{
echo "You have not answered question five
correctly.<br>\n";
}
if ($_POST['question6'] == "c")
{
$score++;
echo "You have answered question six correctly.<br>\n";
}
else
{
echo "You have not answered question six correctly.<br>\n";
}
if ($_POST['question7'] == "a")
{
$score++;
echo "You have answered question seven correctly.<br>\n";
}
else
{
echo "You have not answered question seven correctly.<br>\n";
}
if ($_POST['question8'] == "c")
{
$score++;
echo "You have answered question eight correctly.<br>\n";
}
else
{
echo "You have not answered question eight correctly.<br>\n";
}
if ($_POST['question9'] == "b")
{
$score++;
echo "You have answered question nine correctly.<br>\n";
}
else
{
echo "You have not answered question nine correctly.<br>\n";
}
if ($_Post['question10'] == "a")
{
$score++;
echo "You have answered question Ten correctly. <br>\n";
}
else
{
echo "You have not answered question 10 correctly. <br>\n";
}
if ($_Post['question11'] == "c")
{
$score++;
echo "You have answered question Eleven correctly. <br>\n";
}
else
{
echo "You have not answered question Eleven correctly. <br>\n";
}
if ($_Post['question12'] == "c")
{
$score++;
echo "You have answered question Ten correctly. <br>\n";
}
else
{
echo "You have not answered question 10 correctly. <br>\n";
}
}
else
{
echo "You did not fill in all of the questions. Please press the back button and fill them.";
}
<br>
$total = "$_Post[fl]" . "" . "$score";
echo "You got a score of" . "" . "$total" . "" . "out of 12 possible";
?>
EDIT- the code didnt turn out right. The "if (isset($_POST['question1']) && isset($_POST['question2']) && isset($_POST['question3']) && isset($_Post['question4'])"
should all be on one line.
This is after you press submit on on a previous page. It gives me a parse error, saying theres something wrong with line 9.
Can anyone help?
if (isset($_POST['question1']) && isset($_POST['question2']) && isset($_POST['question3']) && isset($_Post['question4'])
{
echo "You filled in all the questions.<br>\n";
if ($_POST['question1'] == "a")
{
$score++;
echo "You have answered question one correctly.<br>\n";
}
else
{
echo "You have not answered question one correctly.<br>\n";
}
if ($_POST['question2'] == "b")
{
$score++;
echo "You have answered question two correctly.<br>\n";
}
else
{
echo "You have not answered question two correctly.<br>\n";
}
if ($_POST['question3'] == "b")
{
$score++;
echo "You have answered question three correctly.<br>\n";
}
else
{
echo "You have not answered question three correctly.<br>\n";
}
if ($_POST['question4'] == "c")
{
$score++;
echo "You have answered question four correctly.<br>\n";
}
else
{
echo "You have not answered question four correctly.<br>\n";
}
if ($_POST['question5'] == "b")
{
$score++;
echo "You have answered question five correctly.<br>\n";
}
else
{
echo "You have not answered question five
correctly.<br>\n";
}
if ($_POST['question6'] == "c")
{
$score++;
echo "You have answered question six correctly.<br>\n";
}
else
{
echo "You have not answered question six correctly.<br>\n";
}
if ($_POST['question7'] == "a")
{
$score++;
echo "You have answered question seven correctly.<br>\n";
}
else
{
echo "You have not answered question seven correctly.<br>\n";
}
if ($_POST['question8'] == "c")
{
$score++;
echo "You have answered question eight correctly.<br>\n";
}
else
{
echo "You have not answered question eight correctly.<br>\n";
}
if ($_POST['question9'] == "b")
{
$score++;
echo "You have answered question nine correctly.<br>\n";
}
else
{
echo "You have not answered question nine correctly.<br>\n";
}
if ($_Post['question10'] == "a")
{
$score++;
echo "You have answered question Ten correctly. <br>\n";
}
else
{
echo "You have not answered question 10 correctly. <br>\n";
}
if ($_Post['question11'] == "c")
{
$score++;
echo "You have answered question Eleven correctly. <br>\n";
}
else
{
echo "You have not answered question Eleven correctly. <br>\n";
}
if ($_Post['question12'] == "c")
{
$score++;
echo "You have answered question Ten correctly. <br>\n";
}
else
{
echo "You have not answered question 10 correctly. <br>\n";
}
}
else
{
echo "You did not fill in all of the questions. Please press the back button and fill them.";
}
<br>
$total = "$_Post[fl]" . "" . "$score";
echo "You got a score of" . "" . "$total" . "" . "out of 12 possible";
?>
EDIT- the code didnt turn out right. The "if (isset($_POST['question1']) && isset($_POST['question2']) && isset($_POST['question3']) && isset($_Post['question4'])"
should all be on one line.
This is after you press submit on on a previous page. It gives me a parse error, saying theres something wrong with line 9.
Can anyone help?