Welcome Guest, Not a member yet? Register   Sign In
How to validate form dropdown in codeigniter
#1

Can I know, How  to validate form dropdown in codeigniter.

This is my View File


PHP Code:
<div class="form-group">
 
                           <label style="color: #E4BC3A; font-size: 18px">Choosing of the runnre</label>
 
                           <select class="form-control select2" style="width: 100%;" name="runner_id">
 
                               <option value="<?php echo $row2->runner_id ?>"><?php echo $row2->runner_name?></option>
                                <?php foreach ($supporter_data as $row3){
 
                                   ?>
                                    <option value="<?php echo $row3->runner_id ?>"><?php echo $row3->runner_name?></option>
                                    <?php
                                
?>
                            </select>
                        </div> 

This is controller
PHP Code:
   function index()
 
   {
 
       if ($this->input->post())
 
       {
 
           $this->form_validation->set_rules('runner_id''Runner's Name', 'required');
            
        }
        if ($this->form_validation->run() == TRUE)
        {
            $this->Supporter_model->movement_add();
            redirect('
supporter/index');

        }
        $data["supporter_data"] = $this->Supporter_model->runner_data();
        $data["movement_data"] = $this->Supporter_model->movement_list();

        $this->load->model("Requisition_model");
        $data["requisition"] = $this->Requisition_model->public_view();
        $data["requisition_done"] = $this->Requisition_model->public_view_job_done();
        //var_dump($data["requisition"]); die();
        $this->load->view('
supporter/public', $data);
    } 
Reply


Messages In This Thread
How to validate form dropdown in codeigniter - by sanjaya - 05-01-2018, 11:16 AM



Theme © iAndrew 2016 - Forum software by © MyBB