Welcome Guest, Not a member yet? Register   Sign In
How to receive data from Form_A and send to Form_B ? - 26.07.19
#1
Lightbulb 
(This post was last modified: 07-26-2019, 04:13 AM by Porto.)

Hi Guys greetings!

Probably the situation is very simple to solve, but I haven't found the light yet.

1 ° I have a controller and two methods - Method A and Method B.

2° A Method - FORM_A IS SUBMITTED TO FORM_B

3° A Method - Form A collect Form Data through input class: $formData['formfield'] = $this->input->post(NULL, TRUE);

4° A Method - The Form data pass through the validation process.

5° A Method - If the validation process runs it's ok, function "redirect()" redirect to the B Method and must take the Form data with.

____________

1° B Method - FORM_B MUST RECEIVE THE SUBMITTED DATA FROM FORM_A

2° B Method - Form_B is a "second form" where the passed data and the new data must pass through the validation process again. but for that to happen, i need to receive the data from the first form (A Method = Form_A).

3° I tried to collect data through the arrays $formData or $formfield on the Form_B, but i recieve the following error messages.

Severity: Notice

Message:  Undefined variable: formData
Filename: testefolder/form_b.php
Line Number: 13
or
Severity: Notice

Message: Undefined index: username
Filename: testefolder/form_b.php
Line Number: 17

What i did wrong or what is missing please?

Thank you so much in advance!
Below is my code:

******* 1° The Controller and A Method *******


Code:
class Voting extends CI_Controller {

       public function form_a()
       {
       $formData['formfield'] = $this->input->post(NULL, TRUE);

       $this->form_validation->set_rules('username', 'Username', 'required');
       $this->form_validation->set_rules('password', 'Password', 'required');
       $this->form_validation->set_rules('passconf', 'Password Confirmation', 'required');
       $this->form_validation->set_rules('email', 'Email', 'required');        

               if ($this->form_validation->run() == FALSE)
               {
                      $this->load->view('testefolder/form_a'); // 1° VIEW
               }
               else
               {
                     $this->load->view(redirect('voting/form_b',$formData)); // 2° VIEW
               }
       }
}

******* 2° B Method *******

Code:
    public function form_b()
    {

        $formData['formfield'] = $this->input->post(NULL, TRUE);

        $this->form_validation->set_rules('field1', 'Field1', 'required');
        $this->form_validation->set_rules('field2', 'Field2', 'required');
        $this->form_validation->set_rules('field3', 'Field3', 'required');
        $this->form_validation->set_rules('field4', 'field4', 'required');        

        $this->load->view('testefolder/form_b',$formData); // 2° VIEW

    }
Reply


Messages In This Thread
How to receive data from Form_A and send to Form_B ? - 26.07.19 - by Porto - 07-26-2019, 04:11 AM



Theme © iAndrew 2016 - Forum software by © MyBB