<script type="text/javascript"> function validate() { check1 = false; check2 = false; check3 = false; check4 = false; check5 = false; check6 = false; check7 = false; check8 = false; check9 = false; check10 = false; for (i = 0; i < 4; i++) { if (testform.q1[i].checked) { check1 = true; } } for (i = 0; i < 6; i++) { if (testform.q2[i].checked) { check2 = true; } } for (i = 0; i < 5; i++) { if (testform.q3[i].checked) { check3 = true; } } for (i = 0; i < 4; i++) { if (testform.q4[i].checked) { check4 = true; } } for (i = 0; i < 5; i++) { if (testform.q5[i].checked) { check5 = true; } } for (i = 0; i < 4; i++) { if (testform.q6[i].checked) { check6 = true; } } for (i = 0; i < 6; i++) { if (testform.q7[i].checked) { check7 = true; } } for (i = 0; i < 5; i++) { if (testform.q8[i].checked) { check8 = true; } } for (i = 0; i & lt; 5; i++) { if (testform.q9[i].checked) { check9 = true; } } for (i = 0; i < 5; i++) { if (testform.q10[i].checked) { check10 = true; } } if (check1 == false) { alert("You missed Question 1."); event.returnValue = false; } else if (check2 == false) { alert("You missed Question 2."); event.returnValue = false; } else if (check3 == false) { alert("You missed Question 3."); event.returnValue = false; } else if (check4 == false) { alert("You missed Question 4."); event.returnValue = false; } else if (check5 == false) { alert("You missed Question 5."); event.returnValue = false; } else if (check6 == false) { alert("You missed Question 6."); event.returnValue = false; } else if (check7 == false) { alert("You missed Question 7."); event.returnValue = false; } else if (check8 == false) { alert("Oops! You missed Question 8."); event.returnValue = false; } else if (check9 == false) { alert("You missed Question 9."); event.returnValue = false; } else if (check10 == false) { alert(You missed Question 10."); event.returnValue=false; } } // </script>
<form action="result.php" method="post" name="testform" önsubmit="getResults"> <hr /> <h3>1. How much are you willing to spend on a phone per month?</h3> <input type="radio" name="q1" value="A" /> A. £10-£15. <input type="radio" name="q1" value="B" /> B. £15-£20. <input type="radio" name="q1" value="C" /> C. £20-£25. <input type="radio" name="q1" value="D" /> D. £25-£30. <input type="radio" name="q1" value="E" /> E. £30-£35. <input type="radio" name="q1" value="F" /> F. £35-£40. <hr /> <h3>2. Are you good with technology?</h3> <input type="radio" name="q2" value="A" /> A. Yes. <input type="radio" name="q2" value="B" /> B. No. <hr /> <h3>3. Are you looking for a simple phone?</h3> <input type="radio" name="q3" value="A" /> A. Yes. <input type="radio" name="q3" value="B" /> B. No. <hr /> <h3>4. Are you looking for a modern type of phone?</h3> <input type="radio" name="q4" value="A" /> A. Yes. <input type="radio" name="q4" value="B" /> B. No. <hr /> <h3>5. How big do you want the phone to be?</h3> <input type="radio" name="q5" value="A" /> A. Big. <input type="radio" name="q5" value="B" /> B. Medium. <input type="radio" name="q5" value="C" /> B. Small. <input type="radio" name="q5" value="D" /> B. I don't really mind. <hr /> <h3>6. Do you care about the colour of the phone?</h3> <input type="radio" name="q6" value="A" /> A. Yes. <input type="radio" name="q6" value="B" /> B. No. <hr /> <h3>7. Have you ever owned a mobile phone before?</h3> <input type="radio" name="q7" value="A" /> A. Yes. <input type="radio" name="q7" value="B" /> B. No. <hr /> <h3>8. Do you want to be able to use the phone to get out of awkward social situations?</h3> <input type="radio" name="q8" value="A" /> A. Yes. <input type="radio" name="q8" value="B" /> B. No. <hr /> <h3>9. Do you want to be able to access the app store and download apps using your phone?</h3> <input type="radio" name="q9" value="A" /> A. Yes. <input type="radio" name="q9" value="B" /> B. No. <hr /> <h3>10. What happened to the last phone you owned?</h3> <input type="radio" name="q10" value="A" /> A. I got bored of it. <input type="radio" name="q10" value="B" /> B. It broke. <input type="radio" name="q10" value="C" /> C. The contract ran out. <input type="radio" name="q10" value="D" /> D. Other. <input type="hidden" name="page" value="1" /> <center><input class="button" önclick="getResults()" type="submit" value="Submit" /> <input type="reset" value="Clear" /></center></form> <textarea id="result">The right phone for you will be displayed here.</textarea>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)