Welcome Guest, Not a member yet? Register   Sign In
How to pass data from a one form to another
#2

[eluser]CroNiX[/eluser]
Code:
class Some_controller extends CI_Controller {

  public function method1()
  {
    //displays form with dropdown. The forms method submits to "some_controller/method2"
  }

  public function method2()
  {
    //get the submitted dropdown value from the first form
    $dropdown_value = $this->input->post('name_of_dropdown', TRUE);

    //(this would be done in a model, but to keep it short...)
    $data['form'] = $this->db
      ->select('duration, cost')
      ->where(field, $dropdown_value)
      ->get(table)
      ->result_array();

    //send the results of the query to the 2nd form
    $this->load->view(2nd form, $data);

    //in 2nd form view, you can now access $form['duration'] and $form['cost'] to populate your textboxes
  }
}


Messages In This Thread
How to pass data from a one form to another - by El Forum - 08-06-2014, 01:30 PM
How to pass data from a one form to another - by El Forum - 08-06-2014, 03:18 PM
How to pass data from a one form to another - by El Forum - 08-06-2014, 03:45 PM
How to pass data from a one form to another - by El Forum - 08-06-2014, 04:45 PM
How to pass data from a one form to another - by El Forum - 08-06-2014, 05:16 PM
How to pass data from a one form to another - by El Forum - 08-06-2014, 05:55 PM
How to pass data from a one form to another - by El Forum - 08-06-2014, 06:36 PM
How to pass data from a one form to another - by El Forum - 08-06-2014, 07:13 PM
How to pass data from a one form to another - by El Forum - 08-07-2014, 07:29 AM
How to pass data from a one form to another - by El Forum - 08-07-2014, 09:03 AM



Theme © iAndrew 2016 - Forum software by © MyBB