CodeIgniter Forums
Pushing variable from one file to another... - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Pushing variable from one file to another... (/showthread.php?tid=27830)



Pushing variable from one file to another... - El Forum - 02-22-2010

[eluser]rockstyle[/eluser]
How to push some variable from one function to other inside one class. From now i'm using form_hidden but it's really dangerous, because when you edit some user data, you can easily change the value of this form_hidden and change some data of other user.
Can I use variables which was declared one page before, and make it be available for second page? (it's for my forms) I'm looking for option that it'll not be visible in html, not be visible in url bar as some uri segment and not to push it to some cookie, session data...

Any help appreciated.


Pushing variable from one file to another... - El Forum - 02-22-2010

[eluser]stef25[/eluser]
I know you mention "no session data" but you can store session data in the database. Have a look at the user guide: http://ellislab.com/codeigniter/user-guide/libraries/sessions.html

The web being stateless, you have to "store" your data somewhere if you want it to be available from one page load the next. Your options are session, database, cookie, $_POST or $_GET ... that's about it Smile


Pushing variable from one file to another... - El Forum - 02-22-2010

[eluser]rogierb[/eluser]
If you don't want the options stef25 gave you, you can store the value in a file... oh so very 80's

But you best bet would be the sessions table.