• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
passing variables

#1
[eluser]briggl[/eluser]
I have a question that probably has a simple answer but I cannot find it in the doc.

Here is the sample code from the Form Validation tuturial
Code:
<?php
class Form extends Controller {
    function index()
    {
        $this->load->helper(array('form', 'url'));
        $this->load->library('form_validation');

        $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('myform');
        }
        else
        {
            $this->load->view('formsuccess');
        }
    }
}
?>
I want to pass the username and email that were submitted to the formsuccess view and display them, so I added the following lines to the code before the line that passes control to the formsuccess view:
Code:
$data['username'] = 'username';
$data['email'] = 'email';
And I set up the proper code in formsuccess.php to display the data.
Naturally, it just displays 'username' and 'email' instead of what the user (me) entered.
I have tried several different ways, such as $username, username without the quotes, etc.

What do I need to put in place of 'username' and 'email' to do what I want to do?


Messages In This Thread
passing variables - by El Forum - 08-05-2010, 11:25 AM
passing variables - by El Forum - 08-05-2010, 11:47 AM
passing variables - by El Forum - 08-05-2010, 06:12 PM
passing variables - by El Forum - 08-06-2010, 05:35 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.