title: How to get the selected values from multiple radio buttons in html form using php
body: <p>I am new to PHP. I am developing an online examination system. In an HTML page I have arranged questions and for selecting answers I have used four radio buttons for 4 options. Similarly for all the 20 questions. Now what is problem with this is. I want to get the selected value from radio buttons and i want to store it in avariable and i need to calculate the score i.,e no of correct options. Finally i want to store it into database. Can anyone please give me the example code to do this...  this is my html code</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;body&gt;
  
  &lt;font size=+1 color=blue&gt;&lt;u&gt;&lt;h1&gt;C Language exam&lt;/h1&gt;&lt;/u&gt;&lt;/font&gt;&lt;p&gt;
  &lt;form  method="POST" action="validate1.php"&gt;
  &lt;pre&gt;
  &lt;font face="verdana"&gt;
  
  
  1.In C, if you pass an array as an argument to a function, what actually gets passed?
  &lt;p&gt;
  &lt;input type=radio name=1 value=a&gt;A. Value of elements in array&lt;br&gt;
  &lt;input type=radio name=1 value=b&gt;B. First element of the array&lt;br&gt;
  &lt;input type=radio name=1 value=c&gt;C. Base address of the array&lt;br&gt;
  &lt;input type=radio name=1 value=d&gt;D. Address of the last element of array&lt;br&gt;
  
  
  
  2.How will you print \n on the screen?&lt;p&gt;
  &lt;input type=radio name=2 value=a&gt;A. printf("\n");&lt;br&gt;
  &lt;input type=radio name=2 value=b&gt;B. echo "\\n";&lt;br&gt;
  &lt;input type=radio name=2 value=c&gt;C. printf('\n');&lt;br&gt;
  &lt;input type=radio name=2 value=d&gt;D. printf("\\n");&lt;br&gt;
  
  
  
  3.C  is what type of language?&lt;p&gt;
  &lt;input type=radio name=3 value=a&gt;A. Low leval language&lt;br&gt;
  &lt;input type=radio name=3 value=b&gt;B. high level language&lt;br&gt;
  &lt;input type=radio name=3 value=c&gt;C. middle level language&lt;br&gt;
  &lt;input type=radio name=3 value=d&gt;D. medium language&lt;br&gt;
  
  
  
  4.Integer type char storage size.&lt;p&gt;
  &lt;input type=radio name=4 value=a&gt;A. 2 bytes&lt;br&gt;
  &lt;input type=radio name=4 value=b&gt;B. 1 byte&lt;br&gt;
  &lt;input type=radio name=4 value=c&gt;C. 4 byte&lt;br&gt;
  &lt;input type=radio name=4 value=d&gt;D. 8 bytes&lt;br&gt;
  
  
  
  5.What is the output of given program
  #include &lt;stdio.h&gt;  
  int main()
   {    /* my first program in C */    
  printf("Hello, World! \n");      
    return 0;
   }&lt;p&gt;
  &lt;input type=radio name=5 value=a&gt;A. first program&lt;br&gt;
  &lt;input type=radio name=5 value=b&gt;B. world&lt;br&gt;
  &lt;input type=radio name=5 value=c&gt;C. hello world&lt;br&gt;
  &lt;input type=radio name=5 value=d&gt;D. hello&lt;br&gt;
  
  
  
  6.How many times the program will print "welcome" ?
  #include&lt;stdio.h&gt;
  int main()
  {
      printf(“welcome”);
      main();
      return 0;
  }&lt;p&gt;
  &lt;input type=radio name=6 value=a&gt;A. Infinite times&lt;br&gt;
  &lt;input type=radio name=6 value=b&gt;B. 32767 times&lt;br&gt;
  &lt;input type=radio name=6 value=c&gt;C. 65535 times&lt;br&gt;
  &lt;input type=radio name=6 value=d&gt;D. Till stack overflows&lt;br&gt;
  
  
  
  7.Symbol of LOGICAL AND operation&lt;p&gt;
  &lt;input type=radio name=7 value=a&gt;A. &amp;&lt;br&gt;
  &lt;input type=radio name=7 value=b&gt;B. &amp;&amp;&lt;br&gt;
  &lt;input type=radio name=7 value=c&gt;C. &gt;&lt;br&gt;
  &lt;input type=radio name=7 value=d&gt;D. == &lt;br&gt;
  
  
  
  8.What are the different types of real data type in C ?&lt;p&gt;
  &lt;input type=radio name=8 value=a&gt;A. float, double&lt;br&gt;
  &lt;input type=radio name=8 value=b&gt;B. short int, double, long int&lt;br&gt;
  &lt;input type=radio name=8 value=c&gt;C. short int, double, long int&lt;br&gt;
  &lt;input type=radio name=8 value=d&gt;D. double, long int, float&lt;br&gt;
  
  
  
  9.Which statement will you add in the following program to work it correctly?
  #include&lt;stdio.h&gt;
  int main()
  {
      printf(“%f\n”, log(36.0));
      return 0;
  }&lt;p&gt;
  &lt;input type=radio name=9 value=a&gt;A. #include&lt;conio.h&gt;&lt;br&gt;
  &lt;input type=radio name=9 value=b&gt;B. #include&lt;math.h&gt;&lt;br&gt;
  &lt;input type=radio name=9 value=c&gt;C. #include&lt;stdlib.h&gt;&lt;br&gt;
  &lt;input type=radio name=9 value=d&gt;D. #include&lt;dos.h&gt;&lt;br&gt;
  
  
  
  10.What will be the output of the program?
  
  #include&lt;stdio.h&gt;
  int main()
  {
      int i=-3, j=2, k=0, m;
      m = ++i &amp;&amp; ++j || ++k;
      printf(“%d,%d,%d,%d\n”, i, j, k, m);
      return 0;
  }&lt;p&gt;
  &lt;input type=radio name=10 value=a&gt;A.  1,2,0,1&lt;br&gt;
  &lt;input type=radio name=10 value=b&gt;B. -3,2,0,1&lt;br&gt;
  &lt;input type=radio name=10 value=c&gt;C. -2,3,0,1&lt;br&gt;
  &lt;input type=radio name=10 value=d&gt;D.  2,3,1,1&lt;br&gt;
  
  
  
  11.C closely associated with the which operating system?&lt;p&gt;
  &lt;input type=radio name=11 value=a&gt;A. windows&lt;br&gt;
  &lt;input type=radio name=11 value=b&gt;B. linux&lt;br&gt;
  &lt;input type=radio name=11 value=c&gt;C. unix&lt;br&gt;
  &lt;input type=radio name=11 value=d&gt;D. mac&lt;br&gt;
  
  
  
  12.C was developed at Bell Laboratories in which year?&lt;p&gt;
  &lt;input type=radio name=12 value=a&gt;A. 1943&lt;br&gt;
  &lt;input type=radio name=12 value=b&gt;B. 1954&lt;br&gt;
  &lt;input type=radio name=12 value=c&gt;C. 1972&lt;br&gt;
  &lt;input type=radio name=12 value=d&gt;D. 1975&lt;br&gt;
  
  
  
  13.In the following code, the P2 is Integer Pointer or Integer?
  
  Typedef int *ptr;
  ptr p1, p2;&lt;p&gt;
  &lt;input type=radio name=13 value=a&gt;A. Integer&lt;br&gt;
  &lt;input type=radio name=13 value=b&gt;B. Integer pointer&lt;br&gt;
  &lt;input type=radio name=13 value=c&gt;C. Error in declaration&lt;br&gt;
  &lt;input type=radio name=13 value=d&gt;D. None of above&lt;br&gt;
  
  
  
  14.In the following code what is 'P'?
  Typedef char *charp;
  Const charp P;&lt;p&gt;
  &lt;input type=radio name=14 value=a&gt;A. P is a constant&lt;br&gt;
  &lt;input type=radio name=14 value=b&gt;B. P is a character constant&lt;br&gt;
  &lt;input type=radio name=14 value=c&gt;C. P is character type&lt;br&gt;
  &lt;input type=radio name=14 value=d&gt;D. None of above&lt;br&gt;
  
  
  
  15.What is the similarity between a structure, union and enumeration?&lt;p&gt;
  &lt;input type=radio name=15 value=a&gt;A. All of them let you define new values&lt;br&gt;
  &lt;input type=radio name=15 value=b&gt;B. All of them let you define new data types&lt;br&gt;
  &lt;input type=radio name=15 value=c&gt;C. All of them let you define new pointers&lt;br&gt;
  &lt;input type=radio name=15 value=d&gt;D. All of them let you define new structures&lt;br&gt;
  
  
  
  16.How will you free the allocated memory ?&lt;p&gt;
  &lt;input type=radio name=16 value=a&gt;A. remove(var-name);&lt;br&gt;
  &lt;input type=radio name=16 value=b&gt;B. free(var-name);&lt;br&gt;
  &lt;input type=radio name=16 value=c&gt;C. delete(var-name);&lt;br&gt;
  &lt;input type=radio name=16 value=d&gt;D. dalloc(var-name);&lt;br&gt;
  
  
  
  17.Which header file should be included to use functions like malloc()  and  calloc()?&lt;p&gt;
  &lt;input type=radio name=17 value=a&gt;A. memory.h&lt;br&gt;
  &lt;input type=radio name=17 value=b&gt;B. stdlib.h&lt;br&gt;
  &lt;input type=radio name=17 value=c&gt;C. string.h&lt;br&gt;
  &lt;input type=radio name=17 value=d&gt;D. dos.h&lt;br&gt;
  
  
  
  18.Specify the 2 library functions to dynamically allocate memory?&lt;p&gt;
  &lt;input type=radio name=18 value=a&gt;A. Malloc() and memalloc()&lt;br&gt;
  &lt;input type=radio name=18 value=b&gt;B. calloc() and memalloc()&lt;br&gt;
  &lt;input type=radio name=18 value=c&gt;C. Malloc() and calloc()&lt;br&gt;
  &lt;input type=radio name=18 value=d&gt;D. alloc() and calloc()&lt;br&gt;
  
  
  
  19.What are the types of linkages?&lt;p&gt;
  &lt;input type=radio name=19 value=a&gt;A. Internal and External&lt;br&gt;
  &lt;input type=radio name=19 value=b&gt;B. External, Internal and None&lt;br&gt;
  &lt;input type=radio name=19 value=c&gt;C. External and None&lt;br&gt;
  &lt;input type=radio name=19 value=d&gt;D. Internal&lt;br&gt;
  
  
  
  20.who created the new system's first higher-level language?&lt;p&gt;
  &lt;input type=radio name=20 value=a&gt;A. McClure's&lt;br&gt;
  &lt;input type=radio name=20 value=b&gt;B. McIlroy&lt;br&gt;
  &lt;input type=radio name=20 value=c&gt;C. Thompson's &lt;br&gt;
  &lt;input type=radio name=20 value=d&gt;D. Doug McIlroy&lt;br&gt;
  
  
  
  &lt;input type="submit" value="submit"&gt;
  &lt;/font&gt;
  &lt;/pre&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>