I need to mount an array with checkbox id

Asked

Viewed 24 times

0

I need to mount an array that has checkbox id’s that I select. In the code below I have a foreach that assembles a list where I can mark her checkbox, I would like to have an array with the chackbox id selected when I click the "Export".

<div class="catalogo catalogo_index">
    <?php foreach ($categorias as $key_catagoria => $categoria): ?>
        <ul class="lista lista_roteiro_integral">
            <input name="check" type="checkbox" id="check_<?= $categoria->cat_id ?>" class="lista_item_poc_check"/>
            <li class="lista_item_poc"><p><b><?= $categoria->cat_titulo ?></b></p></li>
        </ul>
    <?php endforeach; ?>
    <a href="#" class="custom_button" id="exportar">Exportar</a>
</div>

  • And don’t forget to set the values of checkbox...

  • 1

    <input type="checkbox" id="check" name="check[]" value="value" checked/> Follow javascript and then send it by ajax and take the array as php <script>var meu_array = $('input[name="check[]"]:checked'). map(Function(i, el) { Return el.value; }). get();</script>

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.