I have a code, where when i select a value through Drop-down, the name I am selecting should pass through a PHP variable $ch so a second drop-down which runs a mysql query.
Here is my code for first dropdown:
<select name="cha_name" id="cha_name" onChange="fillcha(this.value);">
<option value="0">--SELECT--</option>
<?php
$res = mysqli_query($con, "select customer_code, customer from master_customer where is_cha = 1 order by customer") or die(mysqli_error($con));
while($row = mysqli_fetch_array($res)){
echo "<option value=\"".$row[1]."$$".$row[0]."\" ".(($row[1]==$wo_order[1])?"selected='selected'":"").">".$row[1]."</option>";
}
?>
</select>
When i select this, the value should be capture in a PHP variable $ch without reloading the page show the PHP variable can be used further in a mysql query. Kindly help as I am still in learning phase for JQuery and Ajax.
the mysql query is as follows:
SELECT container_no FROM `cex_work_order_det` WHERE `cha_name`='$cha'