vendredi 23 septembre 2016

When I select check box in the view page and pass it to controller, it is not getting parsed

<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?>
<html>
<head><title>INOVATE</title></head>
<body>
Hi,<?php echo $uname; ?><br><br>
FIELDS:
<table>
<tr><?php if($iot==1){echo "IOT";} else {?>IOT<input name="interests[]" type='checkbox' value='1'><br> <?php } ?></tr><br>
<tr><?php if($hss==1){echo "HSS";} else {?>HSS<input name="interests[]" type='checkbox' value='2'><br><?php }?></tr><br>
<tr><?php if($apps==1){echo "APPLICATIONS";}else {?>APPLICATIONS<input name="interests[]" type='checkbox' value='3'><br><?php } ?></tr><br>
<tr><?php if($netNSec==1){echo "Networking and security";}else {?>netNSec<input name="interests[]" type='checkbox' value='4'><br><?php } ?></tr><br>
<input type='submit' value='add' name='add'>
</table>

$data['uname']=$this->model->fetch('uname',$phone);
        $data['iot']=$this->model->fetch('iot',$phone);
        $data['hss']=$this->model->fetch('hss',$phone);
        $data['apps']=$this->model->fetch('apps',$phone);
        $data['netNSec']=$this->model->fetch('netNSec',$phone);
        $data['mentor']=$this->model->fetch('mentor',$phone);
        $data['ventCap']=$this->model->fetch('ventCap',$phone);
        $data['devel']=$this->model->fetch('devel',$phone);

        $this->load->view('page21',$data);
        if(isset($_POST))
        {

            $ints=$this->input->post('interests');
                if(is_array($ints) || is_object($ints))
                {
                    foreach ($ints as $i)
                    {
                        echo "<script>alert($i)</script>";
                    }
                }
            $this->model->update($phone,$ints);
        }

These are the view and controller pages respectively. Even if I checked the boxes in view page, the controller is not detecting. Please suggest any changes you consider are necessary.




Aucun commentaire:

Enregistrer un commentaire