0
I’m inserting information into a form and I need my selects to be dependent. In this case, I have two selects, containing status information and from the selected state, the city information will appear in the other select. How to do?
<div id="info-geo">
<form name="novosDados" action="conexao.php" method="POST">
<legend class="titulo" >Adicionar novo registro </legend> <br><br>
<div class="w3-row-padding">
<div class="w3-half">
<label for="name">Estado</label>
<select class="w3-select" name="estado">
<option value="" disabled selected>Escolha um estado</option>
<option value="BR">MG</option>
<option value="EDE">SP</option>
<option value="EVR">RJ</option>
</select>
</div>
<div class="w3-half">
<label for="name">Cidade</label>
<select class="w3-select" name="cidade">
<option value="" disabled selected>Escolha uma cidade</option>
<?php
if ($estado == 'MG'){ ?>
<option value="BH">Belo Horizonte</option>
<option value="Ipatinga">Ipatinga</option>
<?php
}
?>
</select>
</div>
....
....
....
....
</form>
How to get this $status amount from my first select ?
For what you want to do, do you have to select a state to search for the related cities?
– gabrielfalieri
Take a look at this repository, it simplifies this work https://gist.github.com/ografael/2037135
– Pedro Augusto
How could I implement ?
– Alexsander Caproni
Give me about 10 minutes!
– gabrielfalieri
Better, let’s open a chat!! Gets better from chatting
– gabrielfalieri
For all I care
– Alexsander Caproni
I think Voce has to open, an option will appear while we comment
– gabrielfalieri
How to open the chat ?
– Alexsander Caproni
Let’s go continue this discussion in chat.
– gabrielfalieri
I sent you there
– gabrielfalieri
related https://answall.com/questions/254739/ajuda-com-combo-box-com-ajax/254809#254809
– user60252