title: $('input[name=nameofinput]:checked').val()'s value undefined
body: <p>I am trying to send the value of an input to another page.</p>
  
  <pre><code>    $( this ).attr( "href", '?module=module_progress_report&amp;Subject='+ $('input[name=subject]:checked').val()+ '&amp;Centre_Selected_ID='+ encodeURIComponent($( this ).attr('data-centre')) + '&amp;Class_Selected_Year='+ encodeURIComponent($( this ).attr('data-year')) + '&amp;Class_Selected_All='+ encodeURIComponent($( this ).attr('data-all-centre')) +'&amp;StartDate='+$('#report_date_start').val()+'&amp;EndDate=18/12/2016');
  </code></pre>
  
  <p>Here,</p>
  
  <pre><code>$('input[name=subject]:checked').val()
  </code></pre>
  
  <p>This always returns undefined. The value is not getting selected. If I select one of the selection as default, then its value gets stored. What do I need to do?</p>
  
  <h2>Edit</h2>
  
  <p>Here is the PHP and HTML:</p>
  
  <pre><code>&lt;form class="small-box-footer" style="text-align:left;padding:10px;"  method="post" name="nameHere"&gt;
  
                                &lt;?php
                                $query = "SELECT * FROM subject";
                              //$query="SELECT * FROM $base_name";
                              $result = mysql_query($query);
                              while ($row39 = mysql_fetch_array($result)) {
                                  $Referrer_ID = $row39['Subject_ID'];
                                  $Referrer_Name = $row39['Subject_Name'];      
                                  ?&gt;
  
  &lt;input type="checkbox" class="subject-selected" name="subject" value="&lt;?=$Referrer_ID?&gt;"&gt; &lt;?=$Referrer_Name?&gt;&lt;?=$Referrer_ID?&gt;&lt;br /&gt;
  
  &lt;?php } ?&gt;
  
  &lt;/form&gt;     
  </code></pre>
  
  <p>Below is the HTML:</p>
  
  <pre><code>&lt;input type="checkbox" class="subject-selected" name="subject" value="2"&gt; GCSE Maths2&lt;br /&gt;
  
                                                           &lt;!--&lt;a href="#" class="small-box-footer" data-id="&lt;?php=$Referrer_Name?&gt;" data-subject="GCSE English"   data-report-range="month"&gt;
                                        &lt;i class="fa fa-arrow-circle-right"&gt;&lt;/i&gt;
                                      &lt;/a&gt;  
                                      --&gt;
                                  &lt;input type="checkbox" class="subject-selected" name="subject" value="3"&gt; GCSE English3&lt;br /&gt;
  
                                                           &lt;!--&lt;a href="#" class="small-box-footer" data-id="&lt;?php=$Referrer_Name?&gt;" data-subject="GCSE Science"   data-report-range="month"&gt;
                                        &lt;i class="fa fa-arrow-circle-right"&gt;&lt;/i&gt;
                                      &lt;/a&gt;  
                                      --&gt;
                                  &lt;input type="checkbox" class="subject-selected" name="subject" value="4"&gt; GCSE Science4&lt;br /&gt;
  
                                                           &lt;!--&lt;a href="#" class="small-box-footer" data-id="&lt;?php=$Referrer_Name?&gt;" data-subject="GCSE Art"   data-report-range="month"&gt;
                                        &lt;i class="fa fa-arrow-circle-right"&gt;&lt;/i&gt;
                                      &lt;/a&gt;  
                                      --&gt;
                                  &lt;input type="checkbox" class="subject-selected" name="subject" value="5"&gt; GCSE Art5&lt;br /&gt;
  
                                                           &lt;!--&lt;a href="#" class="small-box-footer" data-id="&lt;?php=$Referrer_Name?&gt;" data-subject="GCSE Sociology"   data-report-range="month"&gt;
                                        &lt;i class="fa fa-arrow-circle-right"&gt;&lt;/i&gt;
                                      &lt;/a&gt;  
                                      --&gt;
                                  &lt;input type="checkbox" class="subject-selected" name="subject" value="6"&gt; GCSE Sociology6&lt;br /&gt;
  
                                                           &lt;!--&lt;a href="#" class="small-box-footer" data-id="&lt;?php=$Referrer_Name?&gt;" data-subject="OCR Nationals ICT"   data-report-range="month"&gt;
                                        &lt;i class="fa fa-arrow-circle-right"&gt;&lt;/i&gt;
                                      &lt;/a&gt;  
                                      --&gt;
                                  &lt;input type="checkbox" class="subject-selected" name="subject" value="8"&gt; OCR Nationals ICT8&lt;br /&gt;
  
                                                           &lt;!--&lt;a href="#" class="small-box-footer" data-id="&lt;?php=$Referrer_Name?&gt;" data-subject="OCR Nationals Sports"   data-report-range="month"&gt;
                                        &lt;i class="fa fa-arrow-circle-right"&gt;&lt;/i&gt;
                                      &lt;/a&gt;  
                                      --&gt;
                                  &lt;input type="checkbox" class="subject-selected" name="subject" value="9"&gt; OCR Nationals Sports9&lt;br /&gt;
  
                                                           &lt;!--&lt;a href="#" class="small-box-footer" data-id="&lt;?php=$Referrer_Name?&gt;" data-subject="OCR Nationals Business Studies"   data-report-range="month"&gt;
                                        &lt;i class="fa fa-arrow-circle-right"&gt;&lt;/i&gt;
                                      &lt;/a&gt;  
                                      --&gt;
                                  &lt;input type="checkbox" class="subject-selected" name="subject" value="10"&gt; OCR Nationals Business Studies10&lt;br /&gt;
  
                                                           &lt;!--&lt;a href="#" class="small-box-footer" data-id="&lt;?php=$Referrer_Name?&gt;" data-subject="Entry Science"   data-report-range="month"&gt;
                                        &lt;i class="fa fa-arrow-circle-right"&gt;&lt;/i&gt;
                                      &lt;/a&gt;  
                                      --&gt;
                                  &lt;input type="checkbox" class="subject-selected" name="subject" value="11"&gt; Entry Science11&lt;br /&gt;
  
                                                           &lt;!--&lt;a href="#" class="small-box-footer" data-id="&lt;?php=$Referrer_Name?&gt;" data-subject="Functional Skills English"   data-report-range="month"&gt;
                                        &lt;i class="fa fa-arrow-circle-right"&gt;&lt;/i&gt;
                                      &lt;/a&gt;  
                                      --&gt;
                                  &lt;input type="checkbox" class="subject-selected" name="subject" value="12"&gt; Functional Skills English12&lt;br /&gt;
  
                                                           &lt;!--&lt;a href="#" class="small-box-footer" data-id="&lt;?php=$Referrer_Name?&gt;" data-subject="Functional Skills Maths"   data-report-range="month"&gt;
                                        &lt;i class="fa fa-arrow-circle-right"&gt;&lt;/i&gt;
                                      &lt;/a&gt;  
                                      --&gt;
                                  &lt;input type="checkbox" class="subject-selected" name="subject" value="13"&gt; Functional Skills Maths13&lt;br /&gt;
  
                                                           &lt;!--&lt;a href="#" class="small-box-footer" data-id="&lt;?php=$Referrer_Name?&gt;" data-subject="ESOL"   data-report-range="month"&gt;
                                        &lt;i class="fa fa-arrow-circle-right"&gt;&lt;/i&gt;
                                      &lt;/a&gt;  
                                      --&gt;
                                  &lt;input type="checkbox" class="subject-selected" name="subject" value="14"&gt; ESOL14&lt;br /&gt;
  
                                                           &lt;!--&lt;a href="#" class="small-box-footer" data-id="&lt;?php=$Referrer_Name?&gt;" data-subject="Preparation for Working Life"   data-report-range="month"&gt;
                                        &lt;i class="fa fa-arrow-circle-right"&gt;&lt;/i&gt;
                                      &lt;/a&gt;  
                                      --&gt;
                                  &lt;input type="checkbox" class="subject-selected" name="subject" value="15"&gt; Preparation for Working Life15&lt;br /&gt;
  </code></pre>