Get the value of a select option from the html and put in the query.

1

I have a huge question, it would be as follows;

I need to get the value of the Select Option that is in the HTML form and play in the SQL query that is in the same .PHP file,

    <select name="origem" id="origem">
  <option>-- Selecione a Origem --</option>
  <?php
                $Q_secc = "SELECT codigo,descricao FROM seccionamentos ORDER BY descricao";
                $R_secc = mysql_query($Q_secc,$conexao);
                while ($l_secc = mysql_fetch_array($R_secc)){
                ?>
  <option value="<?=$l_secc['codigo']?>">
  <?=utf8_encode($l_secc['descricao']);?>
  </option>
  <?php } ?>
</select>

This is already being fed by the above select. and below is another select option, except that it would have to be fed by the value selected above.

<select name="horario" id="horario">
  <option>-- Selecione a Horário --</option>
  <?php
                $Q_horario = "SELECT H.codigo, H.horario
                           FROM tarifas T
                           INNER JOIN linhas L ON L.codigo = T.linha
                           INNER JOIN horarios H ON H.linha = L.codigo
                           WHERE T.origem = valor do 1º combo
                           AND T.destino= 170
                           AND H.sentido = 'I'
                           AND ((MID(H.frequencia, 1, 1) = 'S') AND 
                           (MID(H.frequencia1002, 1, 1) = 'S'))
                           ORDER BY H.horario
                ";
                $R_secc = mysql_query($Q_horario,$conexao);
                while ($l_secc = mysql_fetch_array($R_secc)){
                ?>
  <option value="<?=$l_secc['codigo']?>">
  <?=utf8_encode($l_secc['horario'])?>
  </option>
  <?php } ?>
</select>

I would like no where to be the value of the 1st combobox source.

    
asked by anonymous 17.05.2018 / 17:07

0 answers