im trying to get some data from a DropDown menu and i want to use that value when it change to make a Query in a secound DropDown but until now, i was unable to send the Value to my php with the javascript.
Im using this code:
<script type="text/javascript" language="javaScript">
  function flow() {
    
    var x = document.getElementById("txt_maq").value;
    document.getElementById("demo").innerHTML = x;
    
    var maq = document.getElementById('txt_maq').value;
    var cat = document.getElementById('txt_catmaterial').value;
    if (maq != "")
    {
      document.getElementById('txt_catmaterial').disabled=false;
    }
    if (cat == "")
    {
      document.getElementById('txt_material').disabled=true;
    }
    if (cat != "")
    {
      document.getElementById('txt_material').disabled=false;
    }
                
                
  }
</script>
<div class="col-2">
      <div class="input-group">
        <label class="label">Maq. Destino</label>
        <div class="rs-select2 js-select-simple select--no-search">
          <select id="txt_maq" name="txt_maq" onchange="flow()">
            <option value="">Selecione</option>
            <option value="E02">E02</option>
            <option value="E03">E03</option>
            <option value="E04">E04</option>
            <option value="E05">E05</option>
            <option value="E06">E06</option>
            <option value="E07">E07</option>
            <option value="E08">E08</option>
            <option value="E04/E07">E04/E07</option>
            <option value="E04/E08">E04/E08</option>
            <option value="E03/E04">E03/E04</option>
            <option value="E03/E07">E03/E07</option>
            <option value="E04/E07/E08">E04/E07/E08</option>
            <option value="E03/E07/E08">E03/E07/E08</option>
            <option value="E07/E08">E07/E08</option>
            <option value="E09">E09</option>
          </select>
          <div class="select-dropdown"></div>
          </div>    
        </div>
      </div>
</div>
<div class="row row-space">
  <div class="col-2">
    <div class="input-group">
      <label class="label">Cat. Material</label>
      <div class="rs-select2 js-select-simple select--no-search">
        <select id="txt_catmaterial" disabled="true" name="txt_catmaterial" onchange="flow()">
            <option value=""></option>
            <?php
              $maquina = $_POST['txt_maquina'];
              $type_te = "";
              if ($maquina == "E09"){
                $type_te= "ET";
              } else {
                $type_te= "EP";
              }
              
              echo $type_te;
              $selecione = "";
              $consulta = "SELECT Cat_Material FROM cat_mat where TE = '".$type_te."' "; //código SQL
                    
                $resultado = mysqli_query($ligacao,$consulta);
                while ($listar = mysqli_fetch_array($resultado)){
                    $catmat = $listar['Cat_Material'];
                    
                    echo "<option value=".$catmat.">$catmat</option>";
                }
            ?>                                          
        </select>   
                    
        <div class="select-dropdown"></div>
      </div>        
    </div>
  </div>
</div>
All I try to do is make a If if the txt_maq is E09 so I can do the query in the txt_catmaterial but the value doesn't come from the javascript.
 
     
    