Beste leden,

Ik heb hieronder mijn "winkelwagen" script gepost. Nu wil ik graag de producten die in mijn winkelwagen staan verzenden naar de database. Echter lukt dit mij niet.

Kan iemand mij helpen?
gr

PHP Code:
<?php
include ("includes/connect.php");
    if(isset(
$_POST['submit'])){
        foreach(
$_POST as $key => $value){
            
$key explode("-",$key);
            
$key end($key);
            
$key explode("submit",$key);
            
$key end($key);
            
            if(isset(
$_POST['quantity-'.$key]) <= 0){
                unset(
$_SESSION['cart'][$key]);
            } else if(
$_POST['quantity-'.$key] >= 50){
                
$_SESSION['cart'][$key]['quantity'] = 50;
            } else {
                
$_SESSION['cart'][$key]['quantity'] = $value;
            }
        }
    } 
error_reporting(0);
?>
<h1>Bekijk winkelwagen</h1>
<a href="beveiligdepagina.php?page=products">Ga terug naar de producten pagina.</a><br />
<?php $sql "SELECT * FROM producten WHERE id_product IN (";
                foreach (
$_SESSION['cart'] as $id => $value){
                    
$sql .= $id ",";
                }
                
$sql substr($sql,0,-1).") ORDER BY id_product ASC";
                
$query mysql_query($sql);
            if(empty(
$query)){
                echo 
"Je moet een product toevoegen om toegang te krijgen op deze pagina.<br /><br />";
            }
?>
<form method="post" action="#">
<fieldset>
    <table>
        <tr>
            <th>Naam</th>
            <th>Hoeveelheid</th>
            <th>Prijs per product</th>
            <th>Totaal prijs</th>
        </tr>
        <?php 
        
            $sql 
"SELECT * FROM producten WHERE id_product IN (";
                foreach (
$_SESSION['cart'] as $id => $value){
                    
$sql .= $id ",";
                }
                
$sql substr($sql,0,-1).") ORDER BY id_product ASC";
                
$query mysql_query($sql);
                
$total_price 0;
                if(!empty(
$query)){
                while (
$row mysql_fetch_array($query)){
                    
$subtotal $_SESSION['cart'][$row['id_product']]['quantity']*$row['prijs'];
                    
$total_price += $subtotal;
                    
?>
                        <tr>
                            <td><?php echo $row['naam'];?></td>
                            <td><input type="text" name="quantity-<?php echo $row['id_product'];?>" size="5" value="<?php echo $_SESSION['cart'][$row['id_product']]['quantity'];?>" style="width: 30px; height: 18px; margin-left: 17px;"/></td>
                            <td><?php echo "€" $row['prijs'];?></td>
                            <td><?php echo"€" .  $_SESSION['cart'][$row['id_product']]['quantity']*$row['prijs'];?></td>
                        </tr>
                     <?php
                
} }
            
?>
            <tr>
                <td></td>
                <td></td>
                <td>Totaal prijs:</td>
                <td><?php echo"€" $total_price;?></td>
             </tr>
          </table>
          <br />
          <input type="submit" name="submit" value="Update winkelwagen"/></fieldset>
       </form><br />
       <form method="POST" action="afrekenen.php">
       <input type="submit" name="submit" value="Afrekenen"/></fieldset>
       </form><br />
       <p>Om een product te verwijderen, dient u de hoeveelheid op <strong>0</strong> te zetten.</p>