Welcome Guest, Not a member yet? Register   Sign In
print all data that has been posted in form, into confirmation view
#1

[eluser]Brad K Morse[/eluser]
I am creating a confirmation view, and I need to grab all the data that was posted from a post and pass it into that view.

There must be a simple way of doing this...

something like...

Code:
$data[] = $this->input->post('name_of_form');
$this->load->view('confirmation-view', $data);

Then within the view, I can print it out like:

Code:
<?=$first_name?>

<?=$last_name?>

<?=$email?>

Trying to avoid:

Code:
$data['email'] = $this->input->post('email'); $data['first_name'] = $this->input->post('first_name'); ...

or if there is a better way of creating confirmation before db insertion, I am all ears.

Thank you.

UPDATE:

Controller

Code:
$data['steps'] = $this->input->post('step_id[]');
$data['message'] = $this->input->post('message');
$data['department_id'] = $this->input->post('department_id');
$this->load->view('confirmation-view',$data);

Problem now is storing the step_id[] appropriately, it does not display in the confirmation view. step_id[] is a series of checkboxes, that have the same name (step_id[]), I do not know how to store that array of values into the $data['steps'] array, to be passed into the confirmation view.

View

Code:
<h3>Department</h3>
<p>&lt;?=$department_id?&gt;</p>

<h3>Message</h3>
<pre>&lt;?=$message?&gt;</pre>

<h3>Steps</h3>
&lt;?php print_r($steps); ?&gt;

Resolved; Had to take the [] out of step_id in the post, so now it works with $data['steps'] = $this->input->post('step_id');

If there is a better way to do this, I am still all ears. Smile


Messages In This Thread
print all data that has been posted in form, into confirmation view - by El Forum - 12-03-2010, 12:34 PM



Theme © iAndrew 2016 - Forum software by © MyBB