I am working on a project where I have one List that contains the company name, and the second list is the companies location (One Company can have many locations). I want the user to pick the company and then only be able to select the relevant locations. I udnerstand that using php the form needs to submitted, but am unsure of how that works. I've tried using the "this.form.submit()" method which to my understanding is a javascript call. However this call is not doing anything at all. Here is the relevant code:
Thanks
Code:
<form action="eform.php" method="post" name="client">
<p align="left"><strong>Client Information </strong></p>
<p align="left"> Name:
<?php
$conn = new COM('ADODB.Connection'); //for MS Access connection
$conn = odbc_connect('clientinfo','Terminal','');
echo'<select name="ClientName" onchange=>"this.form.submit()"';
$sql = 'SELECT * FROM Clients';
$clookup = odbc_exec($conn,$sql);
while (odbc_fetch_row($clookup))
{
$PID=odbc_result($clookup,"PrimeID");
if($PID!=$PrevPID)
echo "<option value=\"".$PID."\">".$PID."</option><br>";
$PrevPID=$PID;
}
echo '</select>';
?>
</p>
<p align="left">Location:
<?php
$conn = new COM('ADODB.Connection'); //for MS Access connection
$conn = odbc_connect('clientinfo','Terminal','');
echo'<select name="Location" onchange=>';
$sql = 'SELECT * FROM Clients WHERE PrimeID = '.$_POST['ClientName'];
$clookup = odbc_exec($conn,$sql);
while (odbc_fetch_row($clookup))
{
$Loc=odbc_result($clookup,"SecondID");
if($PID!=$PrevPID)
echo "<option value=\"".$Loc."\">".$Loc."</option><br>";
$PrevPID=$PID;
}
echo '</select>';
?>
</p>
</form>
Thanks