i want add these qiuz to wap site ... but i need help create result.php like this
i get errors in result.php help me to fix it..
thankz
and i want send these result as sms or email ..
please help me
This is Quiz.php
this is result.php
i get errors in result.php help me to fix it..
thankz
TRUE: 1,2,4,5,7,9,10,12,13,14,16,17,19
FALSE: 3,6,8,11,15,18
How You Scored
19-17 correct answers- You are in very good health
16-14 correct answers – You get depressed sometimes
13 or less correct answers- You’re very often down in the dumps. Start healing your mind and body today!
FALSE: 3,6,8,11,15,18
How You Scored
19-17 correct answers- You are in very good health
16-14 correct answers – You get depressed sometimes
13 or less correct answers- You’re very often down in the dumps. Start healing your mind and body today!
please help me
This is Quiz.php
HTML Code:
<form action="results.php" method="post"> <p align="left">Username: <input type="text" name="name"></p> <p align="left">1.) Usually depression and low self esteem go hand in hand. <br> <input type="radio" name="q1" value="Answer1"> True<br> <input type="radio" name="q1" value="Answer2"> False</p> <p align="left">2.) Many factors play a role in depression including genetics, certain events, medical history, environment and peoples approach toward the situation or challenges.<br> <input type="radio" name="q2" value="Answer1"> True<br> <input type="radio" name="q2" value="Answer2"> False</p> <p align="left">3.) Natural healing methods used in curing depression have greater side effects.<br> <input type="radio" name="q3" value="Answer1"> True<br> <input type="radio" name="q3" value="Answer"> False</p> <p align="left">4.) Nutrition is an important factor in reducing depression.<br> <input type="radio" name="q4" value="Answer1"> True<br> <input type="radio" name="q4" value="Answer2"> False</p> <p align="left">5.) Depression comes from chemical imbalances in the brain.<br> <input type="radio" name="q5" value="Answer1"> True<br> <input type="radio" name="q5" value="Answer2"> False</p> <p align="left">6.) In depression the physical and emotional symptoms can be seen clearly.<br> <input type="radio" name="q6" value="Answer1"> True<br> <input type="radio" name="q6" value="Answer2"> False</p> <p align="left">7.) Depression is a disorder of the body as well as of the mind.<br> <input type="radio" name="q7" value="Answer1"> True<br> <input type="radio" name="q7" value="Answer2"> False</p> <p align="left">8.) The right thing to do is to keep problems to you instead of discussing them with friends and family.<br> <input type="radio" name="q8" value="Answer1"> True<br> <input type="radio" name="q8" value="Answer2"> False</p> <p align="left">9.) Giving importance to the good things in your life instead of the negative ones is healthy for you.<br> <input type="radio" name="q9" value="Answer1"> True<br> <input type="radio" name="q9" value="Answer2"> False</p> <p align="left">10.) Giving up is a big NO. Tough times don’t last but tough people do.<br> <input type="radio" name="q10" value="Answer1"> True<br> <input type="radio" name="q10" value="Answer2"> False</p> <p align="left">11.) Being obese is not a good thing. You should always be thin, only then will you be attractive.<br> <input type="radio" name="q11" value="Answer1"> True<br> <input type="radio" name="q11" value="Answer2"> False</p> <p align="left">12.) Trust your judgment and don’t accept what other people say about you easily, especially if it’s negative.<br> <input type="radio" name="q12" value="Answer1"> True<br> <input type="radio" name="q12" value="Answer2"> False</p> <p align="left">13.) Don’t surround yourself with people who spread bad vibes.<br> <input type="radio" name="q13" value="Answer1"> True<br> <input type="radio" name="q13" value="Answer2"> False</p> <p align="left">14.) Fidgety and nervous people who are irritable and angry all the time are behaving normally.<br> <input type="radio" name="q14" value="Answer1"> True<br> <input type="radio" name="q14" value="Answer2"> False</p> <p align="left">15.) Men are more likely to hide their depression with alcohol and abusive substances.<br> <input type="radio" name="q15" value="Answer1"> True<br> <input type="radio" name="q15" value="Answer2"> False</p> <p align="left">16.) Healing begins from within. The mind has amazing powers to heal oneself.<br> <input type="radio" name="q16" value="Answer1"> True<br> <input type="radio" name="q16" value="Answer2"> False</p> <p align="left">17.) Find good in even the most unworthy of people.<br> <input type="radio" name="q17" value="Answer1"> True<br> <input type="radio" name="q17" value="Answer2"> False</p> <p align="left">18.) A movie, friends, family, music, a good book; these cannot all help you when you are depressed to feel better.<br> <input type="radio" name="q18" value="Answer1"> True<br> <input type="radio" name="q18" value="Answer2"> False</p> <p align="left">19.) Some people eat more and put on weight when they are depressed and further lower their self esteem.<br> <input type="radio" name="q19" value="Answer1"> True<br> <input type="radio" name="q19`" value="Answer2"> False</p> <p align="left"><input type="submit" name="submit" value="Submit Quiz"></p> <input type="hidden" name="qp" value="quiz.php"> </form>
PHP Code:
<?php
$title = "Quiz Results";
echo "<title>$title</title>";
if (isset ($_POST['submit'])) {
$name = $_POST['name'];
$q1 = "1.)" . $_POST['q1'];
$q2 = "2.)" . $_POST['q2'];
$q3 = "3.)" . $_POST['q3'];
$q4 = "4.)" . $_POST['q4'];
$q5 = "5.)" . $_POST['q5'];
$q6 = "6.)" . $_POST['q6'];
$q7 = "7.)" . $_POST['q7'];
$q8 = "8.)" . $_POST['q8'];
$q9 = "9.)" . $_POST['q9'];
$q10 = "10.)" . $_POST['q10'];
$q11 = "11.)" . $_POST['q11'];
$q12 = "12.)" . $_POST['q12'];
$q13 = "13.)" . $_POST['q13'];
$q14 = "14.)" . $_POST['q14'];
$q15 = "15.)" . $_POST['q15'];
$q16 = "16.)" . $_POST['q16'];
$q17 = "17.)" . $_POST['q17'];
$q18 = "18.)" . $_POST['q18'];
$q19 = "19.)" . $_POST['q19'];
$qp = "20.)" . $_POST['qp'];
}
if ($name == "") {
die ("You forgot something, go back and check over your quiz.");
}
if ($q1 == "Answer1")
{
echo "Question 1 corect!<br/>";
$score = "1";
}
if ($q2 == "Answer1")
{
echo "Question 2 correct!<br/>";
$score = $score + 1;
}
if ($q3 == "Answer2") {
echo "Question 3 correct!<br/>";
$score = $score + 1;
}
if ($q4 == "Answer1")
{
echo "Question 1 corect!<br/>";
$score = "1";
}
if ($q5 == "Answer1")
{
echo "Question 1 corect!<br/>";
$score = "1";
}
if ($q6 == "Answer2")
{
echo "Question 1 corect!<br/>";
$score = "1";
}
if ($q7 == "Answer1")
{
echo "Question 1 corect!<br/>";
$score = "1";
}
if ($q8 == "Answer2")
{
echo "Question 1 corect!<br/>";
$score = "1";
}if ($q9 == "Answer1")
{
echo "Question 1 corect!<br/>";
$score = "1";
}if ($q10 == "Answer1")
{
echo "Question 1 corect!<br/>";
$score = "1";
}if ($q11 == "Answer2")
{
echo "Question 1 corect!<br/>";
$score = "1";
} if ($q12 == "Answer1")
{
echo "Question 1 corect!<br/>";
$score = "1";
}if ($q13 == "Answer1")
{
echo "Question 1 corect!<br/>";
$score = "1";
} if ($q14 == "Answer1")
{
echo "Question 1 corect!<br/>";
$score = "1";
} if ($q15 == "Answer2")
{
echo "Question 1 corect!<br/>";
$score = "1";
} if ($q16 == "Answer1")
{
echo "Question 1 corect!<br/>";
$score = "1";
} if ($q17 == "Answer1")
{
echo "Question 1 corect!<br/>";
$score = "1";
} if ($q18 == "Answer2")
{
echo "Question 1 corect!<br/>";
$score = "1";
}if ($q19 == "Answer1")
{
echo "Question 1 corect!<br/>";
$score = "1";
}
echo "<p>Results: $name<br> Score = $score <br>";
?>
Comment