**Model :**

```
class Popupmodel extends CI_model {

    public function __construct() {
        parent::__construct();
    }

    public function form_insert($data) {
        $this->db->insert('users', $data);
    }

    public function Popup() {

    }
}

```

**controller:**

```
<?php

class Popup extends CI_Controller {

    public function __construct() {
        parent::__construct();
        $this->load->model('Popupmodel');
    }

    public function index() {

        $this->load->helper('form');
        $this->load->library('form_validation');
        $this->form_validation->set_error_delimiters('<div class="error">', '</div>');

        $this->form_validation->set_rules('uname', 'Name', 'required|alpha');
        $this->form_validation->set_rules('cnumber', 'Contact Number', 'required|regex_match[/^[0-9]{10}$/]');

        if ( $this->form_validation->run() == FALSE ) {
            $this->load->view("popup");
        } else {
            $data = array('uname'   =>$this->input->post('uname'),
                          'cnumber' =>$this->input->post('cnumber')
                         );

        $this->Popupmodel->form_insert($data);
        $data['$message'] = 'Data Saved';
        $this->load->view('home', $data);
        }
    }
}

?>

```

**view:**

```
<html>
    <head>
        <title>White Gold Institute of Technical Education</title>
        <link rel="shortcut icon" type="image/png" href="<?php echo base_url('assets/images/backu.png'); ?>" />
        <?= link_tag ('assets/css/bootstrap.min.css') ?>
        <?= link_tag ('assets/css/style2.css') ?>
        <script type="text/JavaScript">
            /* If User click anywhere outsite of the modal, Modal will close */

            var modal = document.getElementById('modal-wrapper');
            window.onclick = function(event) {
                if (event.target == modal ) {
                    modal.style.display = "none";
                }
            }
        </script>
    </head>
    <body onload="document.getElementById('modal-wrapper').style.display='block'" background="<?php echo base_url('assets/images/background.png'); ?>" >
        <div id="modal-wrapper" class="modal">
            <?php echo form_open('', 'class="modal-content animate"'); ?>
            <?php if ( isset($message) ) { ?>
            <center><h5 style="color:green;">Details Saved.</h5></center>
            <?php } ?>
                <div class="imgcontainer">
                <!--    <span onclick="document.getElementById('modal-wrapper').style.display='none'" class="close" title="Close PopUp">&times;</span> -->
                    <img alt="Avatar" class="avatar" src=<?php echo base_url('assets/images/1.png'); ?> />
                    <h1 id="h1">White Gold</h1>
                    <h6 id="h6">Institute of Technical Education</h6>
                </div>
                <div class="container"><br><br><br>
                    <div class="row">
                        <div class="col-sm-12">
                            <div class="col-sm-4 div1">
                                <h2 id="h2">For New User<h2><br><br>
                                <?php echo form_input(array('placeholder'=>'NAME:', 'name'=>'uname', 'id'=>'input')) ?><br>
                                    <span style="color:red; font-size:15px;"><?php echo form_error('uname'); ?></span>
                                <?php echo form_input(array('placeholder'=>'CONTACT NUMBER:', 'name'=>'cnumber', 'id'=>'input')) ?><br>
                                    <span style="color:red; font-size:15px;"><?php echo form_error('cnumber'); ?></span>
                                <?php echo form_submit(array('name'=>'submit', 'id'=>'button', 'value'=>'CONTINUE')) ?>
                            </div>
                            <?php echo form_close(); ?>
                            <div class="col-sm-1 div">
                                <svg height="210" width="500" id="svgelem">
                                    <line x1="0" y1="0" x2="0" y2="200" style="stroke:white;stroke-width:6" />
                                </svg>
                            </div>
                            <?php echo form_open(''); ?>
                            <div class="col-sm-4 div2">
                                <h2 id="h2">For Existing<h2><br><br>
                                <?php echo form_input(array('placeholder'=>'CONTACT NUMBER:', 'name'=>'paswd', 'id'=>'input')) ?><br>
                                <?php echo form_submit(array('name'=>'submit', 'id'=>'button', 'value'=>'CONTINUE')) ?>
                            </div>
                            <?php echo form_close(); ?>
                        </div>
                    </div>  
                </div>
        </div>
    </body>
</html>

```

this is model controller and view code if any one solve this problem it is help full for me thank you.. please