-3
I have the following dropdown menus on my website:
<div class="dropdown">
<button class="btn btn-secondary dropdown-toggle col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12 col-xxl-12" type="button" id="dropdownMenuButton1" data-bs-toggle="dropdown" aria-expanded="false">
Selecione o Campo
</button>
<ul class="dropdown-menu col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12 col-xxl-12" aria-labelledby="dropdownMenuButton1">
<li><a class="dropdown-item">Codigo</a></li>
<li><a class="dropdown-item">Cargo</a></li>
<li><a class="dropdown-item">Tipo</a></li>
<li><a class="dropdown-item">Nome</a></li>
<li><a class="dropdown-item">Nome Usual</a></li>
<li><a class="dropdown-item">Endereco</a></li>
<li><a class="dropdown-item">Numero</a></li>
<li><a class="dropdown-item">Complemento</a></li>
</ul>
</div>
Tipo de Busca:
<div class="dropdown">
<button class="btn btn-secondary dropdown-toggle col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12 col-xxl-12" type="button" id="dropdownMenuButton1" data-bs-toggle="dropdown" aria-expanded="false">
Selecione a Busca
</button>
<ul class="dropdown-menu col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12 col-xxl-12" aria-labelledby="dropdownMenuButton1">
<li><a class="dropdown-item" >Comeca com</a></li>
<li><a class="dropdown-item" >Igual a</a></li>
<li><a class="dropdown-item" >Termina com</a></li>
<li><a class="dropdown-item" >Contem</a></li>
<li><a class="dropdown-item" >Contem as partes</a></li>
</ul>
</div>
<div class="row">
<div class="col-6 col-sm-6 col-md-6 col-lg-6 col-xl-6 col-xxl-6"> </div>
<div class="col-6 col-sm-6 col-md-6 col-lg-6 col-xl-6 col-xxl-6"> <button type="button" class="btn btn-primary col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12 col-xxl-12">Buscar</button> </div>
</div>
I need to take what the user selects in the Dropdown Menus and insert into a PHP variable to make a query in the database through a SELECT. How can I do that?
Please edit the question to limit it to a specific problem with sufficient detail to identify an appropriate answer.
–
Oh my God. I don’t know how to make it more specific than that.
– Jean Nunes
You have to submit an AJAX request to the back end with the dropdown value.
– Augusto Vasques