the website i'm working on is: [a href=\"http://poker.mwrarmyalaska.com/Points/overall2.php\" target=\"_blank\"]http://poker.mwrarmyalaska.com/Points/overall2.php[/a] (still a work in progress) I want the top links on the table to send the corresponding names to the page so that it will ORDER BY here is some of the code. I'm not sure if I have to use a form (im guessing so?) this is my first page i'm trying to create in PHP I know I'm probably doing something stupidly wrong, but I've been playing with it all morning and can't get it to work. Thanks in advance for the help! George [code] <?php $sortby = $_SESSION['SortByValue']; switch($sortby){ case 'Name': $sortby = 'P.Last'; ... snip ... default: $sortby = 't.OverAll'; } $overall_query = "SELECT P.First, P.Last, P.PlayerID, t.Game1,t.Game2,t.Game3,t.Game4,t.Game5,t.Game6,t.Game7,t.Game8, t.OverAll FROM Player AS P, Tournament1Points AS t WHERE P.PlayerID = t.PlayerID AND t.OverAll > 0 ORDER BY $sortby DESC"; $overallresult = mysql_query($overall_query); echo "<br /><table border=1 style='margin-right: auto; margin-left:auto'>" . "<tr>" . "<td><a href=\"overall2.php?SortByValue='Name'\">Name</a></td>" . "<td><a href=\"overall2.php?SortByValue='PlayerID'\">PlayerID</a></td>" . "<td><a href=\"overall2.php?SortByValue='Game1'\">Game 1</a></td>" . "<td><a href=\"overall2.php?SortByValue='Game2'\">Game 2</a></td>" . "<td><a href=\"overall2.php?SortByValue='Game3'\">Game 3</a></td>" . "<td><a href=\"overall2.php?SortByValue='Game4'\">Game 4</a></td>" . "<td><a href=\"overall2.php?SortByValue='Game5'\">Game 5</a></td>" . "<td><a href=\"overall2.php?SortByValue='Game6'\">Game 6</a></td>" . "<td><a href=\"overall2.php?SortByValue='Game7'\">Game 7</a></td>" . "<td><a href=\"overall2.php?SortByValue='Game8'\">Game 8</a></td>" . "<td><a href=\"overall2.php?SortByValue='OverAll'\">Over All</a></td>" . "</tr>"; while ($row = mysql_fetch_row($overallresult)) { $Fname = $row[0]; $Lname = $row[1]; $PlayerID = $row[2]; $Game1 = $row[3]; $Game2 = $row[4]; $Game3 = $row[5]; $Game4 = $row[6]; $Game5 = $row[7]; $Game6 = $row[8]; $Game7 = $row[9]; $Game8 = $row[10]; $OverAll = $row[11]; echo "<tr>" . "<td> $Lname, $Fname </td>" . "<td> $PlayerID </td>" . "<td> $Game1 </td>" . "<td> $Game2 </td>" . "<td> $Game3 </td>" . "<td> $Game4 </td>" . "<td> $Game5 </td>" . "<td> $Game6 </td>" . "<td> $Game7 </td>" . "<td> $Game8 </td>" . "<td> $OverAll </td>" . "<tr>"; } echo "</table>"; mysql_close($conn); ?> [/code]