DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Televizor has posted 1 posts at DZone. View Full User Profile

PHP Checkbox Quiz problem

03.20.2013
| 4587 views |
  • submit to reddit
Hello.
I need some help...
I`ve created an eight question form with radio buttoms and checkboxes, and after you`ll answer to all of these questions you should see your final result. 
Well, the first 4 question were created wuth radio buttoms and works very fine but the last 4 that are created with checkboxes didn`t work. when I has to choose more than one answer, the browser didn`t recognize me all of the options that I`ve selected from the checkboxes.

Please help me.

<html>
<form method='post' action='process.php' id='1'>
<ol>
   <li>
     <h3>Care este altitudinea maxima a Muntilor Stara Platina?</h3>
     
     <div>
     <input type='radio' name='intrebarea1' id='intrebarea1' value='A'
     <label for='intrebarea1A'>A) 2376</label>
     </div>
     
     <div>
     <input type='radio' name='intrebarea1' id='intrebarea1' value='B'
     <label for='intrebarea1B'>B) 1000</label>
     </div>
     
     <div>
     <input type='radio' name='intrebarea1' id='intrebarea1' value='C'
     <label for='intrebarea1C'>C) 5345</label>
     </div>
     
     
     </li>
     
     <h3>Care este altitudinea maxima a Muntilor Pindului?</h3>
     <div>
     <input type='radio' name='intrebarea2' id='intrebarea2' value='A'
     <label for='intrebarea2A'>A) 1911</label>
     </div>
     
     <div>
     <input type='radio' name='intrebarea2' id='intrebarea2' value='B'
     <label for='intrebarea2B'>B) 2911</label>
     </div>
     
     <div>
     <input type='radio' name='intrebarea2' id='intrebarea2' value='C'
     <label for='intrebarea2C'>C) 1000</label>
     </div>
     
     
     
       <h3>Care este altitudinea maxima a Muntilor Jura?</h3>
     <div>
     <input type='radio' name='intrebarea3' id='intrebarea3' value='A'
     <label for='intrebarea3A'>A) 1200m</label>
     </div>
     
     <div>
     <input type='radio' name='intrebarea3' id='intrebarea3' value='B'
     <label for='intrebarea3B'>B) 1300m</label>
     </div>
     
     <div>
     <input type='radio' name='intrebarea3' id='intrebarea3' value='C'
     <label for='intrebarea3C'>C) 1723m</label>
     </div>
     
     
     
     <h3>Care este altitudinea maxima a Muntilor Alpi?</h3>
     <div>
     <input type='radio' name='intrebarea4' id='intrebarea4' value='A'
     <label for='intrebarea4A'>A) 2545</label>
     </div>
     
     <div>
     <input type='radio' name='intrebarea4' id='intrebarea4' value='B'
     <label for='intrebarea4B'>B) 3456</label>
     </div>
     
     <div>
     <input type='radio' name='intrebarea4' id='intrebarea4' value='C'
     <label for='intrebarea4C'>C) 4807</label>
     </div>
     
     
     <h3>Care din urmatoarele sunt unitati de relief din Romania?<h3>
     <div>
     <input type="checkbox" name="intrebarea5" id='intrebarea5' value="A">
     <label for='intrebarea5A'>A) Podisul Getic</label>
     </div>
     
     <div>
     <input type="checkbox" name="intrebarea5" id='intrebarea5' value="B">
     <label for='intrebarea5B'>B) Muntii Ural</label>
     </div>
     
     <div>
     <input type="checkbox" name="intrebarea5" id='intrebarea5' value="C">
     <label for='intrebarea5C'>C) Campia Nord Europeana</label>
     </div>
     
     <div>
     <input type="checkbox" name="intrebarea5" id='intrebarea5' value="D">
     <label for='intrebarea5D'>D) Muntii Pindului</label>
     </div>
     
     
     <h3>Care din urmatoarele orase se afla in Romania?<h3>
     <div>
     <input type="checkbox" name="intrebarea6" id='intrebarea6' value="A">
     <label for='intrebarea6A'>A) Seghedin</label>
     </div>
     
     <div>
     <input type="checkbox" name="intrebarea6" id='intrebarea6' value="B">
     <label for='intrebarea6B'>B) Debretin</label>
     </div>
     
     <div>
     <input type="checkbox" name="intrebarea6" id='intrebarea6' value="C">
     <label for='intrebarea6C'>C) Cernauti</label>
     </div>
     
     <div>
     <input type="checkbox" name="intrebarea6" id='intrebarea6' value="D">
     <label for='intrebarea6D'>D) Iasi</label>
     </div>
     
     
     
     <h3>Care din urmatoarele rauri trec prin Romania?<h3>
     <div>
     <input type="checkbox" name="intrebarea7" id='intrebarea7' value="A">
     <label for='intrebarea7A'>A) Mures</label>
     </div>
     
     <div>
     <input type="checkbox" name="intrebarea7" id='intrebarea7' value="B">
     <label for='intrebarea7B'>B) Elba</label>
     </div>
     
     <div>
     <input type="checkbox" name="intrebarea7" id='intrebarea7' value="C">
     <label for='intrebarea7C'>C) Tamisa</label>
     </div>
     
     <div>
     <input type="checkbox" name="intrebarea7" id='intrebarea7' value="D">
     <label for='intrebarea7D'>D) Volga</label>
     </div>
     
     
       <h3>Care din urmatoarele lacuri nu se afla in Romania?<h3>
     <div>
     <input type="checkbox" name="intrebarea8" id='intrebarea8' value="A">
     <label for='intrebarea8A'>A) L. Rosu</label>
     </div>
     <div>
     <input type="checkbox" name="intrebarea8" id='intrebarea8' value="B">
     <label for='intrebarea8B'>B) L. Sfanta Ana</label>
     </div>
     <div>
     <input type="checkbox" name="intrebarea8" id='intrebarea8' value="C">
     <label for='intrebarea8C'>C) L. Balea</label>
     </div>
     <div>
     <input type="checkbox" name="intrebarea8" id='intrebarea8' value="D">
     <label for='intrebarea8D'>D) L. Ladoga</label>
     </div>
     </ol>
     <input type ='submit' value='Vezi ce nota ai luat'/>

</form>
</html>


Comments

Deepak Kandru replied on Tue, 2013/10/22 - 2:48pm

 For multiple you has to use arrays.