i've got 3 drop down boxes which populate each drop down from the one above but on the 3rd drop down i want it to bring back a value that i selected. The code is below
<tr>
<td width="119">Category</td>
<td width="371">
<select name="cat_id" id="cat_id" onChange="showCompany(this.value);">
<option value="">--Select--</option>
<?php
$sql="select * from category";
$sql_row=mysql_query($sql);
while($sql_res=mysql_fetch_assoc($sql_row))
{
?>
<option value="<?php echo $sql_res["id"]; ?>" <?php if($sql_res["id"] ==$_REQUEST ["cat_id"]) { echo "Selected"; } ?>><?php echo $sql_res["category_name"]; ? ></option>
<?php
}
?>
</select>
</td>
</tr>
<tr>
<td>Company</td>
<td id="td_company">
<select name="company_id" id="company_id">;
<option value="">--Select--</option>
<?php
$sql="select * from company where cat_id='$_REQUEST[cat_id]'";
$sql_row=mysql_query($sql);
while($sql_res=mysql_fetch_assoc($sql_row))
{
?>
<option value="<?php echo $sql_res["id"]; ?>"><?php echo $sql_res["company_name"]; ?></option>
<?php
}
?>
</select>
</td>
</tr>
<tr>
<td>Item</td>
<td id="td_item">
<select name="item_id" id="item_id">
<option value="">--Select--</option>
<?php
$sql="select * from item where comp_id='$_REQUEST[cat_id]'";
$sql_row=mysql_query($sql);
while($sql_res=mysql_fetch_assoc($sql_row))
{
?>
<option value="<?php echo $sql_res["id"]; ?>"><?php echo $sql_res["item_name"]; ?></option>
<?php
}
?>
</select>
</td>
</tr>
<tr>
<td>Price</td>
<td id="td_item">
<?php
$sql="select unit_cost from item where comp_id='$_REQUEST[cat_id]'";
$sql_row=mysql_query($sql);
while($sql_res=mysql_fetch_assoc($sql_row))
{
echo "<td>" . "£" . $sql_res['unit_cost'] . "</td>";
}
?>
</td>
</tr>
<tr>
</tr>
</table>
</form>
so basically i want it to bring back the price from the option i selected, at the moment its bringing back all prices.
e.g. first drop down i select cellings then the company drop down i select Access Panels then 3rd drop down they is 3 items (Arm Strong, Track and Screw) and it brings back all 3 prices where i want to be able to select one and only bring back that price. any ideas?