我准备提交我的项目,但我把所有的表输出合并到一起... 我没有做任何事情,我只是保存并将文件复制到额外的位置,就像备份一样。这是其中一个页面的问题:cart page
这是CSS:
/* my style sheet */
body {
font-family:verdana;
}
body {
width:100%;
}
a:hover {
text-decoration:none; color:red;
}
h1 {
color:blue; text-align:center;
}
h3 {
color:Blue;
text-align:center;
}
p {
font-size;10pt;
text-align:center;
}
header {
width:75%;
padding:10px;
margin-top: 0px;
margin-right: auto;
margin-bottom: 0px;
margin-left: auto;
border:solid;
background-color:#8F9779;
opacity:0.8;
filter:alpha(opacity=80); /* For IE8 and earlier */
}
nav {
width:75%;
padding:10px;
margin-top: 0px;
margin-right: auto;
margin-bottom: 0px;
margin-left: auto;
border:solid;
background-color:#8F9779;
opacity:0.9;
filter:alpha(opacity=90); /* For IE8 and earlier */
}
main {
width:75%;
padding:10px;
margin-top: 0px;
margin-right: auto;
margin-bottom: 0px;
margin-left: auto;
border:solid;
background-color:#8F9779;
opacity:0.9;
filter:alpha(opacity=90); /* For IE8 and earlier */
}
footer {
width:75%;
padding:10px;
margin-top: 0px;
margin-right: auto;
margin-bottom: 0px;
margin-left: auto;
border:solid;
background-color:#8F9779;
opacity:0.9;
filter:alpha(opacity=90); /* For IE8 and earlier */
}
table {
margin-left:auto;
}
table,th,td {
border:solid 1px;
}
table.table-style-one {
table-layout: fixed;
width: 400px;
word-break: break-all;
font-family: verdana,arial,sans-serif;
font-size:11px;
color:#333333;
border-width: 1px;
border-color: #3A3A3A;
border-collapse: collapse;
}
table.table-style-one th {
border-width: 1px;
padding: 8px;
border-style: solid;
border-color: #3A3A3A;
background-color: #B3B3B3;
}
table.table-style-one td {
border-width: 1px;
padding: 8px;
border-style: solid;
border-color: #3A3A3A;
background-color: #ffffff;
}
body {
background: no-repeat fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
}
li {
float: left;
}
a:link, a:visited {
display: block;
width: 110px;
font-weight: bold;
/* color: #3B444B;
3B444B background-color: #8F9779;*/
text-align: center;
padding: 4px;
text-decoration: none;
text-transform: uppercase;
target-name:new;
target-new:tab;
}
/*
a:hover, a:active {
background-color: #F0FFFF;
}*/
#category ul {
float: left;
width: 100%;
padding: 0;
margin: 0;
list-style-type: none;
}
#category a {
float: left;
padding: 0;
margin: 0;
text-decoration: none;
border-right: 1px solid black;
}
#category a:hover {
background-color: #F0FFFF;
}
#category li {
display: inline;
}
.wrapper {
text-align: center;
}
.wrapper ul {
display: inline-block;
margin: 0;
padding: 0;
/* For IE, the outcast */
zoom:1;
*display: inline;
}
.wrapper li {
float: left;
padding: 2px 5px;
}
cart.php
<?php
if (!isset($_SESSION)) {
session_start();
} //start session
if (!isset($_SESSION['client_ID'])) {
//echo "<script>alert('not logged in');</script>";
header("Location: index.html" );
}
?><!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="keywords" content="Games, Gaming, PS4, PS3, XBOX, Video games">
<meta name="description" content="Games 4 You">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Games 4 You</title>
<link rel="stylesheet" type="text/css" href="Styles/ProductsStyle.css">
<!-- javascript/jQuery -->
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
</head>
<body>
<!--Add the following script at the bottom of the web page (before </body></html>)-->
<script type="text/javascript" async="async" defer="defer" data-cfasync="false" src="https://mylivechat.com/chatinline.aspx?hccid=42206151"></script>
<!-- Header tags above-->
<!-- Start with body tags -->
<script>// disable zoom to keep image fit and always in position
document.firstElementChild.style.zoom = "reset";
</script>
<script type="text/javascript">
// declare list of backgrounds
var images = ['bg-01.jpg', 'bg-02.jpg', 'bg-03.jpg', 'bg-04.jpg', 'bg-05.jpg', 'bg-06.jpg', 'bg-07.jpg'];
// declare function that changes the background
function setRandomBackground() {
// choose random background
var randomBackground = images[Math.floor(Math.random() * images.length)];
// set background with jQuery
$('body').css('background-image', 'url("Images/' + randomBackground + '")');
}
// declare function that sets the initial background, and starts the loop.
function startLoop() {
// Set initial background.
setRandomBackground();
// Tell browser to execute the setRandomBackground every 5 seconds.
setInterval(setRandomBackground, 5 * 1000);
}
// One the page has finished loading, execute the startLoop function
$(document).ready(startLoop);
</script>
<header id="header">
<div class="container">
<center><img src="Images/Title.png" alt="Title">
</div>
</center>
</header>
<center>
<nav>
<?php
echo "<p> Welcome ".$_SESSION['client_name']."</p>";
//create connection
$con = new mysqli("localhost", "student", "student", "cib4003_h00233671_at");
if ($con->connect_errno) { //failed
echo "Failed to connect to MySQL: (" . $con->connect_errno . ") " . $con->connect_error;
}?>
<div class="wrapper">
<ul id="category" >
<li><a href="Products.php">Home</a></li>
<li><a href="Products.php">Products</a></li>
<li><a href="Productscart.php">View Cart</a></li>
<li><a href="ViewOrderHistory.php">Orders</a></li>
<li><a href="Settings.php">Settings</a></li>
<li><a href="logout.php">Logoff</a></li>
</ul>
</nav>
</div>
</center>
<main><!-- start with main tags which will include the php and tables -->
<h3>Games Cart</h3><!-- text above the table using style to move it -->
<?php
//new connection
$con = new mysqli("localhost", "student", "student", "cib4003_h00233671_at");
if ($con->connect_errno) { //failed
echo "Failed to connect to MySQL: (" . $con->connect_errno . ") " . $con->connect_error;
}
//success
// run sql
$sql="SELECT * FROM products,clientscarts WHERE products.Product_Name=clientscarts.Product_Name AND clientscarts.client_ID=".$_SESSION['client_ID'];
$result = mysqli_query($con,$sql);
//output
if(mysqli_num_rows($result)==0) { //no records found
echo "<p>No Orders found! what are you waiting for!? go ahead and get a game & Enjoy</p>";
?>
<center><img src="Images/Happy Gaming.png" alt="Order"></center>
<?php
}
else { // records were found in DB
// echo "<p>You have: ".mysqli_num_rows($result)." pizza(s)</p>";
// echo "<p>You have: ".$totalPizza." pizza(s)</p>";
?>
<table class="table-style-one">
<tr>
<th>Order ID</th>
<th>Product Image</th>
<th>Product Name</th>
<th>Description</th>
<th>Product Type</th>
<th>Price ($)</th>
<th>quantity</th>
<th> </th>
</tr>
<?php
while ($row =mysqli_fetch_array($result)){
echo "<tr>";
echo "<td>".$row['Order_ID']."</td>";
echo "<td><img src='".$row['picture']."' width=199 height=188 />";
echo "<td>".$row['Product_Name']."</td>";
echo "<td>".$row['Description']."</td>";
echo "<td>".$row['Product_Type']."</td>";
if ($_SESSION['User_Type'] == "VIP" && $row['Discount_VIP'] < 1 ){
echo "<td>".($row['Price'] * $row['Discount_VIP'] )."$<h4 style=font-size:3> After Discount</h1></td>";
}
else if ($_SESSION['User_Type'] == "Silver" && $row['Discount_Silver'] < 1 ) {
echo "<td>".($row['Price'] * $row['Discount_Silver'] )."$<h4 style=font-size:3> After Discount</h1></td>";
}
else {
echo "<td>".$row['Price']."$ </td>";
}
echo "<td><center><a href='increasequantity.php?PID=".$row['Order_ID']."'/><h4>Increase ➕</h4></a>".$row['quantity']."<a href='decreasequantity.php?PID=".$row['Order_ID']."'/><h4>Decrease ➖</h4></a></center></td>";
echo "<td> <a href='removeorder.php?PID=".$row['Order_ID']."'/>Remove from cart </a></td>";
echo "</tr>";
if ($_SESSION['User_Type'] == "VIP" && $row['Discount_VIP'] < 1 ) {
$total=$total+($row['Price'] * $row['Discount_VIP']);
}
else if ($_SESSION['User_Type'] == "Silver" && $row['Discount_Silver'] < 1 ) {
$total=$total+($row['Price'] * $row['Discount_Silver']);
}
else {
$total=$total+($row['Price']*$row['quantity']);
}
$totalGames=$totalGames+($row['quantity']);
}
echo "<tr><td>Total Games:</td><td>".$totalGames." Game's</td>";
echo "<td> <a href='removeallorder.php'/>Remove All Items</a></td>";
echo "<td ><center>Total bill: ".$total."$ </center></td>";
echo "<td colspan='4'><a href='Billpage.php?total='".$total."'> <img width=200 height=96 src=Images/buy-now.png></a></td>";
echo "</table> ";
}
?></h2>
</main>
</body>
<!-- main tag closed followed by closing body tag -->
<footer><!-- footer start here with in-line style plus using underline for website link HCT Portal -->
<div id="google_translate_element"></div>
<script type="text/javascript">
function googleTranslateElementInit() {
new google.translate.TranslateElement({pageLanguage: 'en', layout: google.translate.TranslateElement.InlineLayout.HORIZONTAL, multilanguagePage: true}, 'google_translate_element');
}
</script>
<script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
</footer><!-- Close footer -->
</html><!-- close HTML tag -->