title: drop down filtering using subpages from database
body: <p><a href="https://i.stack.imgur.com/Y91dn.png" rel="nofollow noreferrer">screenshot</a>
  the problem is ,if i select the drop down it has to filter the data according to dropdown, which needs template and application form. but there is a problem with javascript.it didn't works fine. didn't able to filter.
  messed up with javascript and php. i cant able to find the problem. below is the php code and javascript.
  javascript</p>
  
  <pre><code>$(document).ready(function() {
  
      function addRemoveClass(theRows) {
  
          theRows.removeClass("odd even");
          theRows.filter(":odd").addClass("odd");
          theRows.filter(":even").addClass("even");
      }
  
      var rows = $("table#myTable tr:not(:first-child)");
  
      addRemoveClass(rows);
  
  
      $("#selectField").on("change", function() {
  
          var selected = this.value;
  
          if (selected != "All") {
  
              rows.filter("[position=" + selected + "]").show();
              rows.not("[position=" + selected + "]").hide();
              var visibleRows = rows.filter("[position=" + selected + "]");
              addRemoveClass(visibleRows);
          } else {
  
              rows.show();
              addRemoveClass(rows);
  
          }
  </code></pre>
  
  <p>html &amp; php</p>
  
  <pre><code>       &lt;select id="selectField"&gt;
                  &lt;option value="All" selected&gt;All&lt;/option&gt;
                  &lt;option value="Special"&gt;Special Needs Template&lt;/option&gt;
                  &lt;option value="Application"&gt;Application Form&lt;/option&gt;
  
  
              &lt;/select&gt;
  &lt;table width="95%" border="0"  cellpadding="5" cellspacing="0" id="myTable" class="table_fullwidth"&gt;
  &lt;tr&gt;&lt;th width="15.8%"&gt;Application&lt;/th&gt;&lt;th width="6%"&gt;Sequence&lt;/th&gt;&lt;th width="22%"&gt;Group&lt;/th&gt;
  &lt;th width="18%"&gt;Field&lt;/th&gt;&lt;th width="20%"&gt;Description&lt;/th&gt;&lt;th width="7%"&gt;Align&lt;/th&gt;&lt;th width="6%"&gt;Allow Null&lt;/th&gt;&lt;th width="6%"&gt;Edit&lt;/th&gt;
  &lt;/tr&gt;
  
  
  
  
  
  &lt;div id ="table-filter"&gt;
  
  &lt;?php $i=1;
  while ($myrow1 = DB_fetch_array($result)) { 
   if ($i % 2==0) $bkg='td1'; else $bkg='td2';
  ?&gt;
  
  
  &lt;tr position="Special"  id="trow_&lt;?php echo $i;?&gt;" class="&lt;?php echo $bkg;?&gt; "&gt;
  &lt;td align="center"&gt;&lt;input type="hidden" name="cur_id_&lt;?php echo $i;?&gt;" id="cur_id_&lt;?php echo $i;?&gt;" value="&lt;?php echo $myrow1['id'];?&gt;"&gt;
  
  
  
  &lt;input tabindex="&lt;?php echo $i;?&gt;_2" class="sel_long1 required" type="text" name="field1&lt;?php echo $i;?&gt;" id="field1_&lt;?php echo $i;?&gt;" value="&lt;?php echo $myrow1['appd'] ;?&gt;" readonly&gt;  &lt;/td&gt;
  
  
  
  
  &lt;td align="center" &gt;&lt;input class="sel_long1 required" type="text"  value="&lt;?php echo $myrow1['sequence']; ?&gt;" name="field2&lt;?php echo $i; ?&gt;" id="field2_&lt;?php echo $i; ?&gt;" &gt;&lt;/td&gt;
  
  
  
  
  &lt;td align="center" &gt;&lt;?php
  
  $sql1 = "SELECT id, descr, lang FROM enr_applicationgroup1 WHERE  lang =".$_SESSION['lang']." order by seq";
  $result1= DB_query($sql1,$db);
  ?&gt;
  &lt;select class="sel_long1 required"  name="field3&lt;?php echo $i; ?&gt;" id="field3_&lt;?php echo $i; ?&gt;"  &gt;
  &lt;?php
  while ($row1 = DB_fetch_array($result1)) {?&gt;
  &lt;option &lt;?php if ($myrow1['groupid']==$row1['id']) {?&gt; selected="selected" &lt;?php } ?&gt; value="&lt;?php echo $row1['id'];?&gt;"  &gt;&lt;?php echo $row1['descr'];?&gt;&lt;?php }?&gt;&lt;/option&gt;
  
  &lt;/select&gt;&lt;/td&gt;
  
  
  &lt;td align="center"&gt;&lt;?php
  
  $sql1 = "select * from wiz_dbtags where lang=".$_SESSION['lang']." and hide=0 and dbaseid=2  and rtrim(ltrim(tablename)) in (".$tablename.")  order by description asc";
  
  $result1= DB_query($sql1,$db);
  ?&gt;
  
  &lt;select class="sel_long1 required"  name="field4&lt;?php echo $i; ?&gt;" id="field4_&lt;?php echo $i; ?&gt;"  &gt;
  &lt;?php
  while ($row1 = DB_fetch_array($result1)) {?&gt;
  &lt;option &lt;?php if ($myrow1['tagid']==$row1['id']) {?&gt; selected="selected" &lt;?php } ?&gt; value="&lt;?php echo $row1['id'].'_'.$row1['description'];?&gt;"  &gt;&lt;?php echo $row1['description'];?&gt;&lt;?php }?&gt;&lt;/option&gt;
  
  &lt;/select&gt;&lt;/td&gt;
  
  
  
  
  &lt;td align="center" width="17%"&gt;&lt;input class="sel_long1 required" type="text"  value="&lt;?php echo $myrow1['description']; ?&gt;" name="field5&lt;?php echo $i; ?&gt;" id="field5_&lt;?php echo $i; ?&gt;" &gt;&lt;/td&gt;
  
  &lt;td align="center" &gt;
  &lt;select class="sel_long1 required" name="field6&lt;?php echo $i; ?&gt;"  id="field6_&lt;?php echo $i; ?&gt;" &gt;
  &lt;option &lt;?php if ($myrow1['align']==1) {?&gt; selected="selected" &lt;?php } ?&gt; value="1"  &gt; Center&lt;/option&gt;
  &lt;option &lt;?php if ($myrow1['align']==2) {?&gt; selected="selected" &lt;?php } ?&gt; value="2"  &gt;Left&lt;/option&gt;
  &lt;option &lt;?php if ($myrow1['align']==3) {?&gt; selected="selected" &lt;?php } ?&gt; value="3"  &gt;Right&lt;/option&gt;
  
  &lt;/select&gt;&lt;/td&gt;
  
  
  &lt;td align="center"&gt;&lt;input &lt;?php if ($myrow1['oraseq']==1) echo 'disabled'; if ($myrow1['allownull']==1)echo 'checked';?&gt;  type="checkbox" name="field7&lt;?php echo $i; ?&gt;" id="field7_&lt;?php echo $i; ?&gt;" &gt;
  &lt;/td&gt;
  &lt;td align="center" width="8%"&gt;&lt;input &lt;?php  if ($myrow1['allowedit']==1)echo 'checked';?&gt;  type="checkbox" name="field8&lt;?php echo $i; ?&gt;" id="field8_&lt;?php echo $i; ?&gt;" &gt;
  &lt;/td&gt;
  
  
  
  
  &lt;td align="center"&gt; &lt;img src="&lt;?php echo $site_path;?&gt;images/del.png" width="20" class="cur" title="Delete" onclick="deleteitem('&lt;?php echo $myrow1['id'];?&gt;');"&gt;&lt;/td&gt; 
  &lt;/tr&gt;
  &lt;?php
  $i++;
  
  }
  
  
  
  
  
  $breakdown = $_POST['breakdown']+$num_rows;
  $j=$num_rows+1;
  </code></pre>