I am constructing a contact form and want the fields to pull in information from two different tables in the same mysql database. The first three fields display correctly but I am struggling to get the users details from the second table to display.
Here is the code I currently have.
<?php
$id =$_REQUEST['ID'];
$result = mysql_query("SELECT * FROM boomcat WHERE ID  = '$id'");
$test = mysql_fetch_array($result);
if (!$result) 
        {
        die("Error: Data not found..");
        }
                $image=$test['Image'] ;
                $id=$test['ID'] ;                   
                $name=$test['Name'] ;
?>  
<?php
$result = mysql_query("SELECT * FROM members WHERE member_id='".$_SESSION['SESS_MEMBER_ID'] ."'");
$test = mysql_fetch_array($result);
if (!$result)
{
    die("Error: Data not found..");
    }
    $first=$test['FirstName'] ;
    $email=$test['Email'] ;
  ?>
<table>
<form name="contactform" action="memcontact-process.php" method="post" onSubmit = "return contactcheck();">
<td><img class="img" width="100" height="100" src="../../<?php echo $image ?>"/></td>
        <td><input type="hidden" name="Image" value="<?php echo $image ?>" /></td>
    </tr>
            <tr>
        <td>ID:</td>
        <td><input type="text" style="border: 1px solid #aaa;" name="ID" value="<?php echo $id ?>" readonly="readonly"/> </td>
    </tr>
    <tr>
        <td>Item:</td>
        <td><input type="text" style="border: 1px solid #aaa;" name="Item" value="<?php echo $name ?>" readonly="readonly"/></td>
    </tr> 
        <td>Name:</td>
        <td><input type="text" style="border: 1px solid #aaa;" name="Name" value="<?php echo $first ?>" readonly="readonly"/></td>
    </tr>    
</table>
</body>
</html>
<?php
 
    