如何使用codeIgniter框架MVC回显我通过post传递的变量

I am trying to save the data from the form into the database but I can't do that... Don't know why. I want to print the variables and see if the variables are being passed via post. How do I echo the variables passed via post and where. I'm new to the MVC model.
So in my view I have (inside a form):

<td>
    <input size="15" type="text" name="val1" id="val1" class="text" value="<?= isset($user) ? set_value('val1',$this->form_validation->val1) : set_value('val1'); ?>"/>
<?= form_error('val1');?>
</td>
<td>
    <input size="15" type="text" name="val2" id="val2" class="text" value="<?= isset($user) ? set_value('val2',$this->form_validation->val2) : set_value('val2'); ?>"/>
<?= form_error('val2');?>
</td>
<td>
    <input size="15" type="text" name="val3" id="val3" class="text" value="<?= isset($user) ? set_value('val3',$this->form_validation->val3) : set_value('val3'); ?>"/>
<?= form_error('val3');?>
</td>

then in my controller:

if($this->input->post('val3')!=''){
        $data = array(
        'id_val' => $id,
        'pass' => $this->input->post('oldVal'),
        'newPass'=> $this->input->post('newVal'),
        'user' => $this -> session ->userdata('username')
    );
    $id_m = $this->val3_model->save($data);

}

if($this->input->post('val1')!=''){
    $data = array(
        'id_val' => $id,
        'pass' => $this->input->post('oldVal'),
        'newPass'=> $this->input->post('newVal'),
        'user' => $this -> session ->userdata('username')
    );
    $id_m = $this->val1_model->save($data);
}

if($this->input->post('val2')!=''){
    $data = array(
        'id_val' => $id,
        'pass' => $this->input->post('oldVal'),
        'newPass'=> $this->input->post('newVal'),
        'user' => $this -> session ->userdata('username')
    );
    $id_m = $this->val2_model->save($data);
}

model:

class Val1_model_model extends CI_Model{
    // table name
    private $table= 'val1';

    function _construc(){
       parent::Model();
    }
   *   
   *  
   *  
    function save($data){
        $this->db->insert($this->table, $data);
        return $this->db->insert_id();
    }
}

At the very beginning of the controller method, you can use var_dump();

var_dump($this->input->post(NULL, TRUE));

The Input::post() method returns data in the $_POST array. Assuming your form uses that method and it posts to that controller/method, this should print the contents of the $_POST array. The first argument allows to specify a specific index (field name), but if you pass NULL (or nothing, eg. $this->input->post()) you will get the entire array of values. The second argument runs it all through a XSS filter, which is desirable.

@AVProgrammer gives you a great way to dump the whole post.

If that doesn't work, you might be doing a few things wrong. First, if you have an action attribute on your form, verify that is is correct. Here is a good article to explain more.

That aside, to answer your specific question, here is an example of outputting the variable in the view itself (after the post):

<?php if ($this->input->post('val3')) { echo $this->input->post('val3'); } ?>

Hope this helps.