Session Class - Add, Edit and Remove |
[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.
[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);
[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.
[eluser]Derek Allard[/eluser]
There's also an undocumented (well, its in the SVN now) Code: $this->session->unset_userdata('item');
[eluser]webdude[/eluser]
is this correct? Code: function add()
[eluser]Derek Allard[/eluser]
Code: function add()
[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
[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
[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 />
[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. |
Welcome Guest, Not a member yet? Register Sign In |