Thanks in advance for any help. I am super new at php and I'm trying to create a single page form with 2 dependent drop down lists that populate a table of data pulled from a sql database table that is dependent on the selection from the second list. So far, I've been able to create the 2 lists and information is coming into them just fine. However, the second list isn't dependent on a selection from the first list. Furthermore, I have no idea how to generate the subsequent list of values in a <table> which would be dependent on the selection from the second list. Any help on this would be certainly appreciated.
Here is the code I have made thus far:
<script language="JavaScript">
function autoSubmit()
{
var formObject = document.forms['theForm'];
formObject.submit();
}
</script>
<?php
/* Program: selecttrailer.php
* Desc: Displays list of trailer models from the database.
*/
$user="root";
$host="localhost";
$passwd="xxxxxx";
$database="trailers";
$cxn = mysqli_connect($host,$user,$passwd,"trailers")
or die("Couldn't connect to server");
$query="SELECT DISTINCT tnttrailer_brand FROM trailerquote ORDER BY tnttrailer_brand";
$query2="SELECT trailer_description FROM trailerquote ORDER BY trailer_description";
$query3="SELECT * FROM trailerquote";
$result = mysqli_query($cxn,$query);
$result2 = mysqli_query($cxn, $query2);
$result3=mysql_query($query3);
?>
<form method='POST' onChange="autoSubmit();">
<select name='brand'>
<?php
while ($row = mysqli_fetch_assoc($result))
{
extract($row);
echo "<option value='$tnttrailer_brand'>$tnttrailer_brand</option>\n";
}
?>
</select>
</form>
<form method="post" onChange="autoSubmit();">
<select name='decription'>
<?php
while ($row = mysqli_fetch_assoc($result2))
{
extract($row);
echo "<option value='$trailer_description'>$trailer_description</option>\n";
}
?>
</select>
</form>
http://www.tnttrailer.com/index.php/dimensions.html <---- This is the web page I'm building it on.