I'm doing a shopping cart simulation with PHP and Mysql .
I need to store a session_id
or any user session ID, so when it exits I will remove the data it stored in the database.
I have already created a column in the database to store this session_id
.
Can anyone help me with this?
I'm trying to use $ _SESSION to store the products:
$dadosProdutos = filter_input_array(INPUT_POST, FILTER_DEFAULT);
if ( isset($dadosProdutos) ):
unset( $dadosProdutos['ProdutoCesta'] );
$_SESSION['cesta'] = $dadosProdutos;
endif;
If the submit button is clicked it takes the data via post and stores it in the session. It's working, but when I insert a new product it clears the session.