Updating single item in a basket with multiple items using php and My Sql -


i making shopping basket website , stuck on updating quantities, have database conected , basket being generated basket table, have loop displays products in users basket , produces form each product generating textbox user can enter quanitity , click submit. have seperate file called updatebasket excutes update statement using gameid in whereclause. having trouble sending gameid each product on updatebasket file when update button clicked. here code below.

this cart.php file

cart.php <?php require "dbconnect.php"; session_start(); $memberid = $_session['id'];   $query = "select rectable.gameid, rectable.gameimg, rectable.gameprice, rectable.gamename rectable, basket rectable.gameid = basket.gameid , basket.id = '".$memberid."'";  $results = $connect->query($query); $numrow = $results->num_rows;  $count = 0; while ($count < $numrow) { $row = $results -> fetch_assoc(); extract($row); echo"<div>"; echo"<div class='recommended_games'>";     echo "<img src='images/".$gameimg."' />"; echo "</div>";   echo '<div class="price_tag">';     echo '<div class="price_tag">£'.$gameprice. '</div>'; echo'</div>';  echo '<div id="update_form"><form action="updatebasket.php" method="post" name="updateform">'; echo  '<input type="text" value="1" name="quantity" id="quantity" />'; echo '<input type="text" value="'.$gameid.'" name="'.$gameid.'" id="gameid" />'; echo    '<input type="submit" value="update" />'; echo '</form>'; echo '</div>';                                              echo"<img class='box1' src='images/grey-banners.png' />"; echo"</div>"; $count = $count + 1;         }         ?> 

this updatebasket.php file

updatebasket.php <?php session_start(); require "dbconnect.php";  $memberid = $_session['id'];   $quantity = $_post['quantity']; $gameid = $_post['gameid'];  $query = "update basket set quantity = '".$quantity."' gameid = '".$gameid."' , id = '".$memberid."' "; header('location: cart.php') ?> 


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -