Session Class - Add, Edit and Remove - 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: Session Class - Add, Edit and Remove (/showthread.php?tid=2481) |
Session Class - Add, Edit and Remove - El Forum - 08-08-2007 [eluser]webdude[/eluser] Are you able to update and remove items in a session using the Session Class? I am building a quoting system which acts like a "shopping cart" where the user adds products on which they want a quote on and will require them to be able to add new items, remove existing or update existing items. Thanks in advanced. Session Class - Add, Edit and Remove - El Forum - 08-08-2007 [eluser]Phil Sturgeon[/eluser] Indeed you can. User Guide: Sessions Add/Edit Code: $this->session->set_userdata('some_name', 'some_value'); Delete Code: $this->session->set_userdata('some_name', NULL); Session Class - Add, Edit and Remove - El Forum - 08-08-2007 [eluser]webdude[/eluser] Thanks will give that ago a bit later. Should I use the form helper or use a standard html coded form? I have a list of products each with a qty textbox next to them and a single submit button at the bottom of the page. Thanks once again. Session Class - Add, Edit and Remove - El Forum - 08-08-2007 [eluser]Derek Allard[/eluser] There's also an undocumented (well, its in the SVN now) Code: $this->session->unset_userdata('item'); Session Class - Add, Edit and Remove - El Forum - 08-08-2007 [eluser]webdude[/eluser] is this correct? Code: function add() Session Class - Add, Edit and Remove - El Forum - 08-08-2007 [eluser]Derek Allard[/eluser] Code: function add() Session Class - Add, Edit and Remove - El Forum - 08-08-2007 [eluser]webdude[/eluser] thanks for the reply. below is a cut down version of my page but i am unable to call/show $this->session->userdata('product'); Code: <?php Session Class - Add, Edit and Remove - El Forum - 08-08-2007 [eluser]Derek Allard[/eluser] try this. Essentially, I'm loading the session library in the contructor so that its available for both add() and productdetails(), and I'm making sure I get session stuff added BEFORE I try to see the results. (I'm also using the url helper, but that's just for convenience.) Code: <?php Session Class - Add, Edit and Remove - El Forum - 08-08-2007 [eluser]webdude[/eluser] Derek, thanks very much for your help and your super fast replies :-) I have updated my code and it works :-) The only issue I have now (well for the moment) is being able to detect dynamically name form items. My form Code: <?=form_open($_SERVER['REQUEST_URI']."add");?> produces Code: <form action="http://bisvalves.orbitalweb.co.uk/products/solenoid-valves/direct-solenoid-valve/add" method="post"> 6B37-A3-S-P</strong><br /> Session Class - Add, Edit and Remove - El Forum - 08-08-2007 [eluser]Derek Allard[/eluser] You're welcome. You probably want to start another thread with that, but that said, try to re-word your problem, I'm not sure I understand it. At any rate, a new thread is definately appropriate. |