How to make an "add to basket" option on my website? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 13

How to make an "add to basket" option on my website?

I want to add an option like "add to basket" on my website. It's a kind of mini game. The option I want to create will allow the user to add many items in a bag and submit. All his choices will be add in the database

21st Oct 2017, 11:05 PM
HOHOUETO Ronald Boris
HOHOUETO Ronald Boris - avatar
5 Answers
+ 4
Okay. Thanks :-)
22nd Oct 2017, 10:43 AM
HOHOUETO Ronald Boris
HOHOUETO Ronald Boris - avatar
+ 4
JavaScript array? // in html call the function addtobasket(); onclick var i=0; var basket = new Array(50); function addtobasket(){ basket[i]="WhatTheUserChose"; document.write(basket[i] + " was added"); i++ ; }
22nd Oct 2017, 6:28 PM
Lil Machina
Lil Machina - avatar
+ 3
Thanks. It will be helpful
22nd Oct 2017, 6:40 PM
HOHOUETO Ronald Boris
HOHOUETO Ronald Boris - avatar
+ 2
you may use php sessions In this case
22nd Oct 2017, 7:52 AM
ELECTRODE
ELECTRODE - avatar
+ 1
or even better , in the items lists ..a button like add to basket ( add_item.php?id=1) in the add items page/file an insert or update table into the database called baskets with the user's id
22nd Oct 2017, 7:56 AM
ELECTRODE
ELECTRODE - avatar