mardi 22 août 2017

Pass multiple checkbox values with using foreach loop. How to pass checkbox values

I have work on codeigniter.

In one page, I shows all values in using foreach loop and all values have checkbox. Of I check multiple value then submitting form?

View:

 <form action="<?php echo base_url(); ?>Home/del_mail/" class="uk-form-stacked" id="product_edit_form" method="POST" enctype="multipart/form-data">
 <?php
 foreach($msg->result() as $row) 
 { ?>
 <tr>
 <td>
 <input type="checkbox" name="forms[]" id="<?php echo $row->id; ?>" value="
 <?php echo $row->id; ?>"> <input type="hidden" name="id<?php echo $row->id; 
 ?>" value="<?php echo $row->id; ?>" id="<?php echo $row->id; ?>">
 </td>
 <td style="font-size: smaller !important;" class="uk-text-nowrap">
 <?php echo $row->mail_for; ?>
 </td>
 </tr> 
 </form>

Controller:

public function del_mail()
{
echo "dasd".$dat = $this->input->post('forms[]');
exit;
for($i=0; $i<count($this->input->post("sel")); $i++)
{
 echo $day[$i] = $this->input->post("days[".$i."]");
}

}




Aucun commentaire:

Enregistrer un commentaire