Hi,
i am getting the value for the drop down from a column (itm_num) in the database and displaying another text field with respective column (deson) value of a form. when i submitting form, the value in the drop down is not getting stored to the database. instead the value of the column (deson) is getting stored. So i am facing the problem of storing the same value of deson in two columns in the database.
myblade.php
<div class="col-12 col-sm-12 col-md-4 col-lg-4">
<label>Maybe</label>
<select id="maybe_1" name="may_1" class="form-control">
<option value="0" disabled="true" selected="true"> Select One </option>
@foreach ($rco_lists as $rco_list)
<option value="{{ $rco_list->deson}}">{{ $rco_list->itm_num }}</option>
@endforeach
</select>
</div>
<div class="col-12 col-sm-12 col-md-4 col-lg-4">
<label for="inputAddress2">Name</label>
<input type="text" class="form-control" readonly id="mat1_nme" name="mat1_nme">
</div>
JS
$(document).ready(function() {
$("#maybe_1").change(function() {
var air_id = $(this).val();
$("#may_1").val(air_id);
});
});
Controller for fetching data from the database
public function findAirName(Request $request){
$p=Rup::select('rco_list')->where('itm_num',$request->deson)->first();
return response()->json($p);
}
Controller for storing back to the database
$sbtd->mtg_1=$req->may_1;
$sbtd->mtg_1_name=$req->mat1_nme;
Please help how to store the value of name "may_1" back in the another in the database