I am using sql to connect to a database and then php to populate list from it, as you can see the second list is populated the decision of the first, now what Im trying to do is when a user selects from the second list I would like to fire a php statement which puts the result in one table -
<p>please select a store.</p>
<select name="menu" id="myStore">
<?php
include("scripts/dbconnect.php");
$query="select distinct store from game order by store asc";
$result=mysql_query($query);
$numrows=mysql_num_rows($result);
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)){
echo '<option value="'.$row['store'].'">'.$row['store'].'</option>';
}
?>
</select><input type="button" onclick="getStore()" value="Submit" /><br/>
<?php
if(isset($_GET['myStore'])){
echo '<p>Select a game.</p>';
echo '<select name="menu" id="myGame">';
include("scripts/dbconnect.php");
$myStore=$_GET['myStore'];
$query="select description from game where store='$myStore'";
$result=mysql_query($query);
$numrows=mysql_num_rows($result);
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)){
echo '<option value="'.$row['description'].'">'.$row['description'].'</option>';
}
echo '</select>';
echo '<input type="button" table()" value="Submit" /><br/>';
}
?>
THIS IS WORKING ALL FINE ^^^^^^^^^^^^
so based on the decision of the 2nd list I would like to fire this statement below and put the answer in a table -
<?php
if(isset($_GET['myGame'])){
include("scripts/dbconnect.php");
$myGame=$_GET['myGame'];
$query="select id from game where description='$myGame'";
$result=mysql_query($query);
print "<table border='1'>";
while ($a = mysql_fetch_array($res)){
print "<tr>
<td>$a[0]</td>
</tr>"; }
print "</table>";
}
?>
I know this is a lot to take in, I appreciate any help, thank you