php forms, pager and tablesorter not working

php forms, pager and tablesorter not working

Hi everyone

I'm using a form to send a set of options to select data using mysql and then presenting that data in a tablesorter class with the pager. The problem is that with the form to select the data, the pager buttons do not work. Sorry complete noob and don't know what I'm doing - any help mucj appreciated.

Some snippets of code below:

<html>
<head>
<title>SPT Point Sources</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
  <script type="text/javascript" src="./js/jquery.tablesorter.js" ></script> 
  <script type="text/javascript" src="./js/addons/pager/jquery.tablesorter.pager.js" ></script> 
  <script type="text/javascript" src="./fancybox/jquery.mousewheel-3.0.2.pack.js"></script> 
  <script type="text/javascript" src="./fancybox/jquery.fancybox-1.3.1.js"></script> 
  
  <link rel="stylesheet" href="./css/jq.css" type="text/css" media="print, projection, screen" />
  <link rel="stylesheet" href="./themes/blue/style.css" type="text/css" id="" media="print, projection, screen" />
  <link rel="stylesheet" href="./fancybox/jquery.fancybox-1.3.1.css" type="text/css" media="screen" /> 


  <script type="text/javascript">
  $(document).ready(function() {
      $("table").tablesorter({
widgets: ['zebra'],
   sortList: [[7,1]] })
.tablesorterPager({ container: $("#pager")});
 
      $("a[rel=example_groups]").fancybox({
'type' : 'image',   
   'transitionIn' : 'none',
   'transitionOut' : 'none',
   'titlePosition' : 'over',
   'titleFormat' : function(title, currentArray, currentIndex, currentOpts) {
   return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
 }
});
    }); </script> 


    </head>

    <body>  
    <div id="banner">
  <h1>Point <em>Sources</em></h1>
  <h2>South Pole Telescope</h2>
  <h3>Point Source Search</h3>
  <a href="../autotools/index.html">Back to Autotools</a>
  </div>
  <div id="main">
  <h1>Search Parameters</h1>
    
  <form name="form1" method="post" action="">

  <table border='0'>
  <tr><td>Source</td><td>SN Min</td><td>SN MaxM</td><td>SN Selector</td></tr>
  <tr>
  <td><input type="text" name="source" value="<?php print $source?>"></td>
  <td><input type="text" name="sn_min" value="<?php print $sn_min?>"></td>
  <td><input type="text" name="sn_max" value="<?php print $sn_max?>"></td>
  <td>
  <input type="radio" name="freq" id="90" value="90"/> 90
  <input type="radio" name="freq" id="150" value="150" checked="checked"/> 150
  <input type="radio" name="freq" id="220" value="220" /> 220
  </td>
  </tr><td>
  <input type="checkbox" name="smooth" value="raw" <?php if($smooth=="raw") { echo "checked";} ?>/> Raw Maps
<td></tr>
</table> 

<p></p>
<input type="submit" value="Submit">
  </form>
  <hr>   
    
  <div id="main">
  <table cellspacing="0" class="tablesorter">
  <caption>Point Source Listing</caption>
  <thead>
  <tr>
  <th>Field</th>
  <th>RA (J2000)</th>
  <th>DEC (J2000)</th>
  <th>90 MJy</th>
  <th>150 MJy</th>
  <th>220 MJy</th>
  <th>90 S/N</th>
  <th>150 S/N</th>
  <th>220 S/N</th>
  <th>AT20G</th>
  <th>SUMSS</th>
  <th>PMN</th>
  <th>Images</th>
  </tr>
  </thead>

  <tbody>
 
  <?php
  include('db_login.php');  
include('astrolib.php');

$astro = new AstroLib();
$table = 'point_sources';

if (!mysql_connect($db_host, $db_user, $db_pwd))
  die("Can't connect to database");

if (!mysql_select_db($database))
  die("Can't select database");

if ($source == "all") {
  $result = mysql_query("SELECT * FROM $table WHERE sn_src_$freq > $sn_min AND sn_src_$freq < $sn_max ORDER BY sn_src_$freq DESC");
} else {
  $result = mysql_query("SELECT * FROM $table WHERE source LIKE '$source' AND sn_src_$freq > $sn_min AND sn_src_$freq < $sn_max ORDER BY sn_src_$freq DESC");
}

if (!$result) {
  die("Query to show fields from table failed");
}

$map_add = ($smooth == "raw") ? 4 : 0;

while($row = mysql_fetch_row($result))
  {
    echo "<tr>";
    $ra = $astro->ra_print($row[1]);
    $dec = $astro->dec_print($row[2]);
    echo "<td>$row[9]</td>";
    echo "<td>$ra</td>";
    echo "<td>$dec</td>";
    echo "<td>$row[4]</td>";
    echo "<td>$row[6]</td>";
    echo "<td>$row[8]</td>";
    echo "<td>$row[3]</td>";
    echo "<td>$row[5]</td>";
    echo "<td>$row[7]</td>";
    echo '<td>'.($row[18] == 0 ? 'No' : 'Yes').'</td>'; 
    echo '<td>'.($row[19] == 0  ? 'No' : 'Yes').'</td>'; 
    echo '<td>'.($row[20] == 0  ? 'No' : 'Yes').'</td>'; 
    echo '<td>';
    $tt = "$row[9] $ra $dec";
    $map_index = 13 + $map_add;
    echo "<a href=\"view.php?id=$row[$map_index]\" rel=\"example_group\" title=\"$tt\"><img src=\"view.php?id=$row[$map_index]\" width=\"50\" height=\"40\" alt=\"\" /></a>";
    $map_index = 10 + $map_add;
    echo "<a href=\"view.php?id=$row[$map_index]\" rel=\"example_group\" title=\"$tt\"><img src=\"view.php?id=$row[$map_index]\" width=\"50\" height=\"40\" alt=\"\" /></a>";
    $map_index = 11 + $map_add;
    echo "<a href=\"view.php?id=$row[$map_index]\" rel=\"example_group\" title=\"$tt\"><img src=\"view.php?id=$row[$map_index]\" width=\"50\" height=\"40\" alt=\"\" /></a>";
    $map_index = 12 + $map_add;
    echo "<a href=\"view.php?id=$row[$map_index]\" rel=\"example_group\" title=\"$tt\"><img src=\"view.php?id=$row[$map_index]\" width=\"50\" height=\"40\" alt=\"\" /></a>";
    echo "</td>";
    echo "</tr>";
  }
?>
</tbody>
</table>
<div id="pager" class="pager"> 
<form> 
<img src="./js/addons/pager/icons/first.png" class="first"/> 
<img src="./js/addons/pager/icons/prev.png" class="prev"/> 
<input type="text" class="pagedisplay"/> 
<img src="./js/addons/pager/icons/next.png" class="next"/> 
<img src="./js/addons/pager/icons/last.png" class="last"/> 
</form> 
</div> 
</div>
</div>
</body>
</html>