1
Good morning,
I have a select where I bring the categories in my php site, after selecting the category I needed to redeem the value field to use it in the select of the sub-category.
I believe that the best form would be in the onchange of the categories. But on the internet I saw only examples where in this same case it was called a new php, in my case it is also in another php, but in this php this gathered several functions and I need to call one in specific.
Follows the codes:
<div class="form-group">
<label class="control-label col-sm-1">Categoria: </label>
<div class="col-sm-3">
<select name="suporte" class="form-control">
<option value="0" disabled="disabled">Escolha um Categoria</option>
<?php carregar_categorias();?>
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-1">Sub-Categoria: </label>
<div class="col-sm-2">
<select name="categoria" class="form-control">
<option value="0" disabled="disabled">Escolha uma categoria primeiro</option>
<?php carregar_subcategorias("1")?>
</select>
</div>
</div>
Thank you very much, from this link I managed to solve my problem.
– Lucas Augusto
Pedro, it is good put the way it is done, even if the link answer the question, because the link can be disabled over time and your answer will no longer make sense :).
– Marco Souza
It’s true @Marconciliosouza. I didn’t pay attention to it. Thank you.
– Pedro Filipe