First of all, I am working on editing mode. I Fetch data from database then match it form selected item from last time. when I change the value of dropdown it does not change it returns me the blank value in $_POST[]
I am populating a Drop Down Box using the following code.
<select name="agency_name" class="form-control">
<option value="">--Select--</option>
<?php
$query_agency= "Select * From `agency_name`";
$count = $db_handle->numRows($query_agency);
if($count != 0){
$i = 0;
$result_agency = $db_handle->runQuery($query_agency);
while($i != $count){
$agencyname = $result_agency[$i]['name'];
?>
<option value="<?php echo $result[0]['Agency_name'] ?>"
<?php if($result[0]['Agency_name']=="$agencyname"){echo "selected";} ?>>
<?php echo $agencyname;?>
</option>
<?php
$i++;
}
}
?>
</select>
I want to show change value and store in the database. Now how can I get the selected option value using PHP because I want the selected value to perform a query in the database.