Hello,
I am able to add one item into the basket. But, I was told that using Javascript I can add more items. Can you please help me?
<?php
require "connect.php";
$query = "SELECT `DVDID`, `NameOfTheDVD`, `Quantity`, `Price` FROM `DVD` ";
$stmt = $dbhandle->prepare($query);
$stmt->execute();
$num = $stmt->rowCount();
echo "<table border='3';>";
echo '<tr>';
echo '<th>DVD</th>';
echo '<th>Quantity</th>';
echo '<th>Price</th>';
echo '<th>Add To Basket</th>';
echo '<th> Description </th>';
echo '</tr>';
if($num>0){
while ($row = $stmt->fetch(PDO::FETCH_OBJ)){
$mydvd = $row->DVDID;
$name = $row->NameOfTheDVD;
$Quantity = $row -> Quantity;
$Price = $row -> Price;
echo '<input type="hidden" name="id" value="'.$mydvd.'">';
echo '<input type="hidden" name="item" value="'.$name.'">';
echo '<input type="hidden" name="Quantity" value="'.$Quantity.'">';
echo '<input type="hidden" name="Price" value="'.$Price.'">';
echo '<input type="hidden" name="Cart" value="'.$cartItemCount.'">';
echo '<tr>';
echo '<td>Name Of the DVD : <br>'.$row->NameOfTheDVD.'<br></td>';
echo '<td>Quantity : '.$row->Quantity.'</td>';
echo '<td>Price: '.$row->Price.'</td>';
echo '<td><button><a href = "basket.php?id='.$mydvd.'&name='.$name.'&Quantity='.$Quantity.'&Cart='.$cartItemCount.'&Price='.$Price.'"> Add To Basket</a><br></button></td>';
echo '<td><button><a href = "Description.php">View Description</a></td>';
echo '</tr>';
echo $mydvd;
//echo '<form method="post" action="basket.php?id='.$mydvd.'">';
//echo '<input type="submit" value="Add To Basket">';
}
}
// no products in the database
else{
echo "No products found.";
}
?>
Above is my PHP code. As you can see I am using URL to send the the parameters.
Just a note, I am not interested in security as it is just a assignment
Thank You