Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (!isset($_SESSION))
- {
- session_start();
- }
- if (!empty($error_message))
- {
- echo '<p style = "color:red">' .$error_message . '</p>';
- }
- require_once "../connection/dbcust.php";
- $session_id = session_id();
- $customer_id = 1;
- $_SESSION['custid'] = $customer_id;
- $conn = @mysqli_connect("$dbhost", "$dbuser", "$dbpassword", "$dbname");
- /*if ($conn)
- {
- echo "connected";
- }
- else
- {
- echo "not connected";
- }
- */
- //working to here
- $query = " SELECT * FROM products";
- $result = @mysqli_query($conn, $query) or die ("did not work");
- while ($rows = mysqli_fetch_array($result))
- {
- ?>
- <form method="post" action="processcart.php">
- <table>
- <tr>
- <td><?php echo $rows['product_name'];?></td>
- <td><?php echo $rows['colour'];?></td>
- <td><?php echo $rows['price'];?></td>
- <input type="hidden" name="product_id" value="<?php echo $rows['product_id']; ?>" />
- <input type="hidden" name="price" value="<?php echo $rows['price']; ?>" />
- <input type="hidden" name="product_name" value="<?php echo $rows['product_name']; ?>" />
- <td><input type="test" name="qtyordered" /></td>
- <td><input type="submit" value="Add to cart" /></td>
- </tr>
- </table>
- </form>
- <?php
- }
- $_SESSION['cart'] = true;
- if (isset($_SESSION['cart']))
- {
- echo '<a href="shopcart.php">View Shopping cart</A>';
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment