123456/ajax/includes/winkelwagen.php

<?php include('db.php'); $del_item=$_GET['del_item']; if($del_item){ $query = "delete from winkelwagen where id =$del_item"; $result = mysqli_query($db_link, $query) or die(mysqli_error($db_link).$query); } $klantid=$_GET['klantid']; $add_boeknr=$_GET['add_boeknr']; $prijs=$_GET['prijs']; if($add_boeknr && $prijs){ $prijs=str_replace(",",".",$prijs); $query = "insert into winkelwagen values(null, 1, $add_boeknr, $prijs)"; $result = mysqli_query($db_link, $query) or die(mysqli_error($db_link).$query); } $query = "select w.id, achternaam, titel, b.boeknr, prijs from winkelwagen w, boeken b,auteurs a where a.auteurnr = b.auteurnr and w.boeknr= b.boeknr and klantid=1"; $result = mysqli_query($db_link, $query) or die(mysqli_error($db_link)); echo " <h3 class='kopje'>Winkelwagen</h3>"; echo "<table border=0 width=100%>"; while($row = mysqli_fetch_array($result)){//auteurs option echo "<tr>"; echo "<td>$row[titel]<br>$row[achternaam]</td>"; echo "<td valign='top' align='right'>"; echo "<img onclick=\"ajax('includes/winkelwagen.php?del_item=$row[id]','winkelwagen')\" src='del.gif' border=0 align='right'>"; echo "&euro; ".number_format($row['prijs'],2)."&nbsp;</td>"; $totprijs+=$row['prijs']; echo "</tr>"; } echo "<tr><td colspan=2 align='right'>Totaal: &euro;".number_format($totprijs,2)."</td></tr>"; echo "</table>"; ?>

Resultaat

Made by Thijs Aarnoudse