Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- if( !isset( $_SESSION['fname'] ))
- {
- header("location: CR_login.php");
- }
- unset($_SESSION['counter']);
- // Establish a connection to the database
- $con = mysqli_connect("localhost", "cairil_php", "phpsql");
- // Check if there were any issues connecting to the database
- if ( mysqli_connect_errno() != 0)
- {
- die("An error occurred trying to establish a connection: " .mysqli_connect_error());
- }
- // Select the database to work with.
- $db = mysqli_select_db ($con , "cairil_php");
- // Specify the query to run
- $sqlString = "INSERT INTO `order` VALUES ('"null"','" . $_POST["CustID"] ."','"null"','"null"','"null"','"null"','1','" . $_POST["Address"] ."','" . $_POST["City"] ."','" . $_POST["State"] ."','" . $_POST["Zip"] ."')";
- // Run the query using the connection established earlier and assign the results to a results object.
- $rs = mysqli_query ($con , $sqlString);
- // Check if update was successful by checking whether the result returned is True
- if ( !$rs)
- {
- $result = "Error processing order. Try again later.".mysqli_error();
- }
- else
- {
- $result = "Order Placed!";
- }
- // Close the connection
- mysqli_close($con);
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <title> CR_placeOrder </title>
- </head>
- <body bgcolor="#bbccaa">
- <br/>
- <br/>
- <br/>
- <center>
- <h3><?php echo($result); ?></h3>
- <br/>
- <br />
- <h3>***********************************************************************************************</h3>
- <br />
- <table>
- <tr>
- <td><a href=CR_products.php><img title"view products" src="/images/b-products.png" alt="View Product" /></a>
- <a href=CR_cart.php><img title"view cart" src="/images/b-shopping.png" alt="View Cart" /></a>
- <a href=CR_change.php><img title"change pass" src="/images/b-change.png" alt="Change Password"/></a></td></tr>
- <tr></tr> <tr></tr>
- <tr><td align="center"><a href=CR_welcome.php><img title="home" src="/images/home_button.png" alt="home" width="150" height="50"/></a> <a href=CR_logout.php><img title"logout" src="/images/exit_button.jpg" alt="Logout" /></a></td></tr>
- </table>
- </center>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement