![]() |
Newbie question - After db update, problem with load - view - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Newbie question - After db update, problem with load - view (/showthread.php?tid=17085) |
Newbie question - After db update, problem with load - view - El Forum - 03-25-2009 [eluser]Unknown[/eluser] Hello, I'm pretty new to Code Ignitor, but I'm truly loving working with it. I have a simple controller updating a users status. I'm using the update string, and then trying to load the users page to display their newly updated status. The update string is working fine. The page I'm trying to load is loading, but the variable I'm trying to pass in the $user array seems to be unavailable. On the view page, I'm looking for $user_id. Here's the code: Code: $user_id = set_value('user_id'); Thanks for any insight! Newbie question - After db update, problem with load - view - El Forum - 03-25-2009 [eluser]jedd[/eluser] What do you get if you insert this into your controller: Code: $user['user_id'] = "foo"; And then in your view, do: Code: <?php echo $user_id; ?> Newbie question - After db update, problem with load - view - El Forum - 03-25-2009 [eluser]Unknown[/eluser] Thanks Jedd. I figured it out, and it was a pretty silly mistake. I was using the following to retrieve my form values in the controller: Code: $user_id = set_value('user_id'); After reading some more posts here, I realized I should have been using: Code: $user_id = $this->input->post('user_id'); Doh! Once I made this change, everything started working as expected. set_value works in the controller, so I've used it in controllers several times throughout this little app! So, now I'm going to go through and correct that. Thanks for the reply. |