Get data from a ckeckbox

1

I have this array that shows me the subjects of a module. Now, I want that once you have selected the license plates you want, when you press a button, the options of the checkbox that I have chosen will be displayed. How could it be done?

$modulos = $GLOBALS['cf'][$_SESSION['cf']];

            foreach ($modulos as $key => $value) {
              echo "<input type='checkbox' name='moduloConfirmado' value='' >$key";
              echo "<br>";
            }
    
asked by 05.12.2017 в 00:10
source

1 answer

0

Simply generate an Array in name of input

foreach ($modulos as $key => $value) {
    echo "<input 
                 type='checkbox' 
                 name='moduloConfirmado[]' 
                 value='$key' >$key";
    echo "<br>";
}

You can see the Array that generates you with the selected checkboxes in PHP with

print_r($_POST['moduloConfirmado']);
    
answered by 05.12.2017 / 14:01
source