Advertisement
Guest User

Untitled

a guest
Oct 30th, 2014
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. <?php
  2. $page_title = "Home";
  3. include('header.inc');
  4. $val = "$";
  5. ?>
  6. <div id="content_wrap">
  7. <div id="products-content">
  8. <h1>Take a look at our cakes. See anything you like?</h1>
  9. <form action="getCake.php" method="get">
  10. <select name="type" id="caketypes">
  11. <option value="all">All</option>
  12. </select>
  13. <input type="submit" value="Submit" />
  14. </form>
  15. <script src="display.js"></script>
  16. <table>
  17. <?php
  18. //Connect
  19. $db = mysqli_connect("localhost","root","","cakecreations");
  20. //query
  21. $results = mysqli_query($db, "select * from cakes");
  22. //process
  23. while($row = mysqli_fetch_array($results))
  24. {
  25. echo "<td>";
  26. print "_____________________________________________";
  27. echo "</td>";
  28. echo "<tr>";
  29. echo "<td>";
  30. print "<h2><a href='Product.php?cakename={$row['cakename']}'>{$row['cakename']}</a></h2>";
  31. echo "</td>";
  32. echo "</tr>";
  33. echo "<tr>";
  34. echo "<td>";
  35. print "<img src='/Assignment/images/{$row['image']}' width='200' height='200' />";
  36. echo "</td>";
  37. echo "<td>";
  38. echo "<table>";
  39. echo "<tr>";
  40. print "<h3>{$row['description']}</h3>";
  41. echo "</tr>";
  42. echo "<tr>";
  43. print "<h3>{$row['baker']}";
  44. echo "</tr>";
  45. echo "<tr >";
  46. echo "<td id='testthing'>";
  47. print "<h3>$val{$row['price']}</h3>";
  48. echo "</td>";
  49. echo "<td>";
  50. if (isset($_SESSION['username']))
  51. {
  52. echo "<button type='button'>add to cart</button>";
  53. }
  54. else
  55. {
  56. echo "<p>Login to add</p>";
  57. }
  58. echo "</td>";
  59. echo "</tr>";
  60. echo "</table>";
  61. echo "</td>";
  62. echo "</tr>";
  63. }
  64. ?>
  65. </table>
  66. </div>
  67. </div>
  68.  
  69. <?php
  70. include('footer.inc');
  71. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement