Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //controller
- class Ctrl extends CI_Controller {
- public function form() {
- $post = $this->input->post();
- $data = array(
- 'form_success_msg' => $this->session->flashdata('form_success')
- );
- if($post){
- $this->load->library('form_validation');
- $this->form_validation->set_rules();
- if ($this->form_validation->run()) {
- $this->session->set_flashdata('form_success', 'Form sent');
- redirect(current_url());
- }
- }
- $this->load->view('form',$data);
- }
- }
- //form view
- <?php if($form_success_msg):?>
- <?=$form_success_msg?>
- <?php endif?>
- <?=form_open(current_url()); ?>
- //your form here
- <?=form_close(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement