How can I insert an array inside another Array when selecting a checkbox?

0

Greetings once again. I'm new to programming php and jquery. I would like you to please help me on the following:

I have a list of months-named checkboxes that are generated through a for with data coming from the database. When it is loaded, it will choose an array with the information of the month and then add that same array into another array multidimensional. What I would like is to add only the array inside the other when I select the checkbox and remove the same case I deselected. Some help please.

This is the code I have:

 <?php
 $read = new Read();

$read->ExeRead('mensalidade','where pago = 0 and ano='.date('Y').' and cod_membro='.$codigo);
$resultados =  $read->getResult();
      $i = 0;
        $array_Meses = array();
foreach ($resultados as $result):
    $i++;
     extract($result);
  ?>
 <tr>

<input class="meses" name="<?php ?>" disabled value="" type="checkbox"> <php? echo $nomeMes ?>

      <?php
      
      /*Informaçoes do mes*/
    array_push($array_Meses,array(
    
        'codigo'=> $codigo,
        'referencia' => $referencia,
        'data_inicio' => $data_inicio,
        'data_fim' => $data_fim,
        'periodicidade' => $periodicidade)
        
        );
                                                         
  ?>
   </tr>
   <?php
   endforeach;
   ?>
    
asked by anonymous 19.10.2018 / 19:00

0 answers