I have a query ($myQ1) that selects information from the database and put it into an array list with a radio button selection. The Value and the name of the document are defined in this radio button. I want to store the value from the selected radio button into a variable "$ObjIndex" and that will give the information needed to run the next three queries. When I select one of the radio buttons I want the table below the list to appear with the information from the query. I can do this using a switch statment but I dont know how. Also, if I dont need it I dont have to have $myQ9 it pulls the same information from $myQ1. Also Note when I set $ObjIndex to a real index number such as "$ObjIndex = '1407'" it does exactly what I need it to do. So if I can just get it to do like "$ObjIndex = '$tog'" and $tog is the value from the selected index. it should work.... I think
**Please excuse my lingo Im very new to this** Also all of this is on one page

PHP Code:
$myQ1 mysql_query("SELECT `iDocuments`.`File`.`FileIndex`, `iDocuments`.`File`.`FileName`, `iDocuments`.`Object`.`ObjectIndex`, `iDocuments`.`Object`.`ObjectName`, `iDocuments`.`Version`.`Version`, `iDocuments`.`File`.`UploadDate` FROM `iDocuments`.`Version` INNER JOIN `iDocuments`.`Object` ON `iDocuments`.`Object`.`ObjectIndex` = `iDocuments`.`Version`.`ObjectIndex` JOIN `iDocuments`.`File` ON `iDocuments`.`Version`.`FileIndex` = `iDocuments`.`File`.`FileIndex` WHERE `Object`.`ObjectStatus` = '1' AND `Version`.`Version` = ( SELECT MAX(`Version`) FROM `iDocuments`.`Version` WHERE `Version`.`ObjectIndex` = `Object`.`ObjectIndex` ) ORDER BY `Object`.`ObjectName` ASC");
if (!
$myQ1
       {  
          echo 
'Could not run query 1: ' mysql_error();
       } 
else 
       { 
      
$row1 mysql_query($myQ1);   
?> 
HTML Code:
<html>
<head>
</head>
<form name="myform" actiopn="<?php $_PHP_SELF ?>" method="get"> 
<table id="my-table"><tr><textarea name="showit" id="showit" value=""></textarea>
PHP Code:
<?php
   
while( $row1 mysql_fetch_array($myQ1) ) 
    {
     echo 
"<td><input type='radio' name='tog' id='tog' onClick='gtdoc()' value='$row1[2]'>$row1[3]</input></td></tr>";
    }

if(isset(
$_GET['tog'])) {
 
$tog $_GET['tog'];
   switch(
$row1) {
     case 
$tog:
       
$tog $ObjIndex;
       break; }
}
echo 
"</table>";


$myQ7 mysql_query("SELECT DISTINCT `iIndex`.`TypeDef`.`Name` FROM `iIndex`.`TypeIndex` JOIN `iIndex`.`TypeDef` ON `iIndex`.`TypeDef`.`Index` = `iIndex`.`TypeIndex`.`TypeID` WHERE `iIndex`.`TypeIndex`.`ObjIndex` = '$ObjIndex' ");
$myQ8 mysql_query("SELECT DISTINCT `iIndex`.`TopicDef`.`Name` FROM `iIndex`.`TopicIndex` JOIN `iIndex`.`TopicDef` ON `iIndex`.`TopicDef`.`Index` = `iIndex`.`TopicIndex`.`TopicID` WHERE `iIndex`.`TopicIndex`.`ObjIndex` = '$ObjIndex' ");
$myQ9 mysql_query("SELECT `iDocuments`.`File`.`FileIndex`, `iDocuments`.`File`.`FileName`, `iDocuments`.`Object`.`ObjectIndex`, `iDocuments`.`Object`.`ObjectName`, `iDocuments`.`Version`.`Version`, `iDocuments`.`File`.`UploadDate` FROM `iDocuments`.`Version` INNER JOIN `iDocuments`.`Object` ON `iDocuments`.`Object`.`ObjectIndex` = `iDocuments`.`Version`.`ObjectIndex` JOIN `iDocuments`.`File` ON `iDocuments`.`Version`.`FileIndex` = `iDocuments`.`File`.`FileIndex` WHERE `Object`.`ObjectStatus` = '1' AND `Version`.`Version` = ( SELECT MAX(`Version`) FROM `iDocuments`.`Version` WHERE `Version`.`ObjectIndex` = `Object`.`ObjectIndex` ) AND `Object`.`ObjectIndex` = '$ObjIndex'");
if (!
$myQ7
       {  
          echo 
'Could not run query 7: ' mysql_error(); 
       }
if (!
$myQ8
       {  
          echo 
'Could not run query 8: ' mysql_error(); 
       }
if (!
$myQ9
       {  
          echo 
'Could not run query 9: ' mysql_error(); 
       }
else 
       { 
          
$row7 mysql_query($myQ7);
          
$row8 mysql_query($myQ8);
      
$row9 mysql_query($myQ9);
          
$aID 0;
       }

  while( 
$row9 mysql_fetch_array($myQ9) ) 
   {
      echo 
"<table name='doclist'>           
      <tr><td>FileID</td><td><input name='DocFileID' type='text' readonly='true' value='
$row9[0]'></input></td></tr> 
      <tr><td>File Name</td><td><input name='DocFileName' type='text' readonly='true' value='
$row9[1]'></input></td></tr> 
      <tr><td>ObjectID</td><td><input name='DocID' type='text' readonly='true' value='
$row9[2]'></input></td></tr>  
      <tr><td>Object Name</td><td><input name='DocName' type='text' readonly='true' value='
$row9[3]'></input></td></tr>  
      <tr><td>Current Version</td><td><input name='CurrVer' type='text' readonly='true' value='
$row9[4]'></input></td></tr>
      <tr><td>Update Date</td><td><input name='lstupdate' type='text' readonly='true' value='
$row9[5]'></input></td> </tr>
      </table>"
;
   }
   while( 
$row8 mysql_fetch_array($myQ8) ) 
    {
      echo 
"<input type='checkbox' name='topicdef'>$row8[0]</input>";
    }
   while( 
$row7 mysql_fetch_array($myQ7) ) 
    {
      echo 
$row7[0];
    }
?>