Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. <?php
  2. $page_title="Add to Cart";
  3. include("header.inc");
  4. if(!isset($_SESSION))
  5. {
  6. session_start();
  7. }
  8. else
  9. {
  10.  
  11. }
  12. ?>
  13. <div id="content_wrap">
  14. <div id="main-content">
  15. <?php
  16.  
  17. $id = $_GET['id'];
  18.  
  19.  
  20. array_push($_SESSION['cart_cake'], $id);
  21.  
  22.  
  23. //connect to the db server
  24. $db = mysqli_connect("localhost", "root", "", "shop") or die(mysqli_error());
  25.  
  26. //execute the select
  27. $q = "select * from $type where id = '$id'";
  28. $results = mysqli_query($db, $q) or die(mysqli_error());
  29.  
  30. while($row = mysqli_fetch_array($results, MYSQL_ASSOC))
  31. {
  32. $name = $row['name'];
  33. print "<h3> $name added </h3>";
  34. print "</br>";
  35. print "Redirecting to Cart";
  36. header( "refresh:1;url=cart.php" );
  37. }
  38.  
  39.  
  40.  
  41.  
  42. ?>
  43. </div>
  44. </div>
  45. <?php
  46. include("footer.inc");
  47. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement