O
O
Oleg Seledets2019-08-01 11:13:14
PHP
Oleg Seledets, 2019-08-01 11:13:14

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 = 'СЮДА ЗНАЧЕНИЕ!''

comboboxes here

<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

1 answer(s)
E
Evgeny Matveev, 2019-08-05
@oleja1ee7

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 question

Ask a Question

731 491 924 answers to any question