Save value from a select in session

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 sub-category.

I think the best way would be in the categories onchange. But for the internet the outside 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.

Follow 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>
    
asked by anonymous 04.03.2016 / 14:58

1 answer

1

One way to do this would be to use AJAX with Jquery. Here's an example where this is done. link

    
04.03.2016 / 15:07