forms - Codeigniter form_open() -


i have form_open in view, , want send data controller, don`t know how read , display data in controller.

<?php echo form_open('login/login'); ?>  <h4 class="form-signin-heading"> <i class="fa fa-user"> &nbsp panel logowania: </i></h4>  <input type="email" name="username" class="form-control" style="margin-bottom:7px;" placeholder="email address" required autofocus>  <input type="password" name="password" class="form-control" placeholder="password" required>   <label class="checkbox">   <small>   <input type="checkbox" value="remember-me"> zapamiętaj mnie   </small>   </label>   <button class="btn btn-sm btn-primary btn-block" style="margin-bottom: 5px;" type="submit">logowanie</button> <?php  echo form_close(); ?> 

how dispaly value input in controller?

in controller don't have display data, have data form , manipulate save database or display in view.

to data form have use input class:

$this->input->post(); 

or

$this->input->get(); 

based on method set in form.

the best way use form helper form validation class, in way can check input before in controller.

lets use form, , suppose controller generate it:

public function login() {     //load library     $this->load->library('form_validation');      //set rules     $this->form_validation->set_rules('username', 'username', 'required');     $this->form_validation->set_rules('password', 'password', 'required');      if( $this->form_validation->run() )     {         //the form correct         $email = $this->input->post('username'); //i form         $password = $this->input->post('password');          //do need     }     else     {         //show form again , in view handle error messages         $this->load->view('login_view')     } } 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -