Answer the question
In order to leave comments, you need to log in
How can I get the current value of "form-control"?
There are two comboboxes, the data for which are taken from the database, how can I make the second combobox, in the SQL query, substitute the value selected in the first combobox.
'SELECT name FROM equip_cost where type = 'СЮДА ЗНАЧЕНИЕ!''
<div class = "col-sm-2">
<select class="form-control" id="combo_type" name="soft_type">
<?php
$result_types = DB::select('SELECT type FROM equip_cost GROUP BY type');
foreach ($result_types as $rtype) {
echo '<option>';echo $rtype->type;echo ' </option>';
}
?>
</select>
</div>
<div class="col-sm-3">
<select class="form-control" id="combo_name" name="soft_name">
<?php
$result_names = DB::select('SELECT * FROM equip_cost where type = "'???" ');
foreach ($result_names as $rname) {
echo '<option>';echo $rname->name;echo ' </option>';
}
?>
</select>
</div>
Answer the question
In order to leave comments, you need to log in
you need to use JavaScript, which, when choosing a value in the first combobox, will substitute it in the second and update it
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question