Well, it could be done simplier with a more complex INSERT
statement:
if(isset($_POST['button']))
{
$query = "INSERT INTO bestelling (username, leveradres, postcode, dier, aantal) ".
" SELECT username, adress, postcode, dier, aantval ".
" FROM winkelwagen ".
" WHERE user_name=? ";
$stmt = $mysqli->prepare($query);
$stmt->bind_param("s",$username);
$stmt->execute();
}
Make sure $mysqli
containis a valid mysqli
database connection
I'm sorry I don't know dutch (is it dutch?), so I'¡m not sure I picked up the correct table and field names.... but I hope you get the idea