Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- ?>
- <html>
- <head>
- <title> Choose roducts </title>
- <link rel="stylesheet" type="text/css" href="highlight_file.css"/>
- </head>
- <body>
- <form action="final.php" method="post">
- <?php
- //Redirect to orderprotein.php if orderid not set.
- if(!isset($_SESSION["orderid"])){
- header("Location: chooseproducts.php");
- die();
- }
- if(!isset($_POST['prodid'])){
- header("Location: chooseproducts.php");
- die();
- }
- //Gather all data from the orderpizza.php page
- $productid=$_POST['prodid'];
- $orderid=$_SESSION["orderid"];
- $quantity = $_POST['quantity'];
- echo 'quantity: '.$quantity;
- //Provide Database connection
- $dbhost = 'localhost:3306'; //hostname:port number
- $dbuser = 'root'; //username
- $dbpass = ''; //password
- $conn = mysql_connect($dbhost, $dbuser, $dbpass); //returns true or false
- if(! $conn )////display error message if connection fails
- {
- die('Could not connect: ' . mysql_error());
- }
- //DISPLAY TOPPINGS ON THE PAGE
- $sql = 'SELECT * FROM PRODUCTS WHERE PRODUCTID ="'.$productid.'"';
- //select your database
- mysql_select_db('supplement');
- //run your query
- $retval = mysql_query( $sql, $conn );
- if(! $retval )
- {
- die('Could not enter data: ' . mysql_error());
- }
- //DISPLAY RECORDS IN TABLE FORMAT
- echo '<center><h2>Shopping Cart <br/></h2></center>';
- echo '<table>';
- while($row = mysql_fetch_array($retval, MYSQL_NUM)){
- //records of the items in the shopping cart
- echo '<table border="2">
- <tr>
- <td> <p> PRODUCT </p> </td>
- <td> <p> PRODUCTID </p> </td>
- <td> <p> DESCRIPTION </p> </td>
- <td> <p> QUANTITY </p> </td>
- <td> <p> PRICE </p> </td>
- </tr>';
- echo '<td> <img src="'.$row[5].'" name="prodid" width="150" height="150"/> </td>';
- echo '<td> <p>"sdfs"<p/></td>';
- echo '<td>Product Description <p>'.$row[6].'<p/></td>';
- echo '<td> <p>'.$row[2].'</p></td></tr>';
- }
- echo '</table>';
- echo '<input type="Submit" value="add this to cart" Name= "add this to cart"/>';
- echo '<br/><br/><a href="orderprotein.php"> Click here to change your Product <a>';
- mysql_free_result($retval);
- mysql_close($conn);
- ?>
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement