Hey Neo and Everyone Else,
I've been learning PHP lately and have been making my own small MVC framework using switch cases. It works well, is simple and does the job.
Now, first question, I have a view file, a product page basically... for some products, I have a some questions and some choices for the buyer to choose from... Now I'd like that when add to cart button is pushed, it should save those added product custom selected options to the session as well. Is that possible?
I tried giving an hyperlink a name and such variations to make it work but it didn't. WIth that, please let me mention here that I'd like to save its options in to session via the add to cart controller logic.... there I mean.
Secondly...... is there any good way of implementing this logic in PHP? As i shared above. I've been stuck at this since very long and its really disturbing me.... I cannot get this specific part of coding thing....
Lots more to do, please guide. Thanks.
Tricky question about usage of $_POST, Hyperlinks and MVC
Re: Tricky question about usage of $_POST, Hyperlinks and MVC
Yes of cause, this is possible. This is how the shopping carts are usually handled.Now, first question, I have a view file, a product page basically... for some products, I have a some questions and some choices for the buyer to choose from... Now I'd like that when add to cart button is pushed, it should save those added product custom selected options to the session as well. Is that possible?
You can keep 3 session keys as below.
Number_of_products
product_code_array[0..(N-1)]
product_option_array[0..(N-1)]
Whenever a new product is added, you increase Number_of_products by one. Then other arrays are updated with information.
See How to store an Array in a Session in php.
Re: Tricky question about usage of $_POST, Hyperlinks and MVC
I maybe able to help you on this, PM me if you still looking for help.