Welcome Guest, Not a member yet? Register   Sign In
How to receive data from Form_A and send to Form_B ? - 26.07.19
#5

(This post was last modified: 08-01-2019, 10:13 AM by Wouter60.)

After succesful form validation in form_a, store the post data into a session variable. Then redirect to voting/form_b.
In form_b, read the session variable into a "normal" array, and pass it to the view "form b".

Controller:
Code:
public function form_a()
{
   if ($this->form_validation->run() == FALSE) }
      // open the view for form a.
   }
   else {
      $this->session->form_a_data = $this->input->post();
      redirect('voting/form_b');
   }
}

public function form_b()
{
   $form_a_data = $this->session->form_a_data;
   if ($this->form_validation->run() == FALSE) }
      // open the view for form b:
      $this->load->view('testefolder/form_b', $form_a_data);
   }
   else {
      //process the output from form b.
       //after that, remove the form_a_data session variable from memory
      unset($_SESSION['form_a_data']);
   }
}

Keep in mind that the view form_b does not know the $form_a_data array itself, because CI extracts it. In form_b you can use the variables $username and $password.
Reply


Messages In This Thread
RE: How to receive data from Form_A and send to Form_B ? - 26.07.19 - by Wouter60 - 08-01-2019, 02:36 AM



Theme © iAndrew 2016 - Forum software by © MyBB