Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
[ Posted by Marlon Mendoza ] the cart.php
<?php
include('php/userloginprocess.php'); // Includes Login Script
include('php/addtocartprocess.php');
$prod_id = $_SESSION['cart'];
/*$id = $_SESSION['prod_id'];
$gadgets = $_SESSION['prod_id'];*/
if($_SESSION['login'] == FALSE){
header("location: login.php");
}
if($_SESSION['login'] == TRUE)
?>
<?php
//connection
mysql_connect("localhost","root", "") or die(mysql_error());
//database connection
mysql_select_db("marketech_db") or die(mysql_error());
//sql query
$sql = "SELECT * FROM user_tbl";
$records=mysql_query($sql);
?>
<html>
<head>
<title> Marketech | Buy Genuine Gadgets Online </title>
<script src="js/jquery.js"></script>
<script src="js/bootstrap.js"></script>
<link rel="stylesheet" href="css/bootstrap.css">
<link rel="shortcut icon" href="images/marketechlogo.ico" />
</head>
<body>
<!-- First Navigation Bar -->
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Marketech</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<form class="navbar-form navbar-left">
<div class="form-group">
<input type="text" class="form-control" placeholder="Search">
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form>
<ul class="nav navbar-nav navbar-right">
<li><a href="#"><span class = "glyphicon glyphicon-shopping-cart"></span> Cart</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><?php echo $_SESSION ['fname']; ?><span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="useraccountsettings.php">Account Settings</a></li>
<li><a href="php/logout.php">Logout</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
<!-- Second Navigation Bar -->
<br><br><br>
<div class = "container-fluid">
<nav class="navbar navbar-inverse navbar-lower">
<div class="container-fluid">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-2" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-2">
<ul class="nav navbar-nav col-lg-12">
<li class="col-md-2"><a href="android.php">Android Phone</a></li>
<li class="col-md-2"><a href="iphone.php">iPhone</a></li>
<li class="col-md-2"><a href="windows.php">Windows Phone</a></li>
<li class="col-md-2"><a href="smartwatch.php">Smart Watch</a></li>
<li class="col-md-2"><a href="computer.php">Computers</a></li>
<li class="dropdown col-md-2"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Popular Brands <span class="caret"></span></a>
<ul class="dropdown-menu col-xs-2">
<li><a href="android.php#samsung">Samsung</a></li>
<li><a href="iphone.php">Apple</a></li>
<li><a href="windows.php">Microsoft</a></li>
<li><a href="android.php#sony">Sony</a></li>
<li><a href="android.php#asus">Asus</a></li>
</ul>
</li>
</ul>
</div>
</div>
</div>
</nav>
<!-- Marketechs Third Navigation (with glyphicons) -->
<div class="container">
<ul class="list-unstyled">
<li class = "col-md-3"><span class="glyphicon glyphicon-transfer"></span> 30 days Free Returns</li>
<li class = "col-md-3"><span class="glyphicon glyphicon-plane"></span> Free Delivery Above 999 php</li>
<li class = "col-md-3"><span class="glyphicon glyphicon-usd"></span> Cash on Delivery</li>
<li class = "col-md-3"><span class="glyphicon glyphicon-earphone"></span> Call (049) 557 2681</li>
</ul>
</div>
</div>
<!-- Cart -->
<div class = "container-fluid">
<form method = "GET" action = "deletecartproduct.php">
<div class = "col-md-9">
<table class = "table table-responsive table-hover">
<tr>
<th>Delete</th>
<th>Item Name</th>
<th>Item Price</th>
<th>Image</th>
</tr>
<?php
//connection
mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("marketech_db") or die (mysql_error());
$sql = "SELECT * FROM product_tbl WHERE prod_id IN (".implode(',',$prod_id).")";
$prod_records = mysql_query($sql);
while($products=mysql_fetch_assoc($prod_records)){
echo "<tr>";
echo "<td>" .'<input type="checkbox" name="products[]" value='.$products['prod_id'].'>'."</td>";
echo "<td>".$products['item_name']."</td>";
echo "<td>".$products['item_price']."</td>";
echo "<td>".$products['item_image']."</td>";
echo "</tr>";
}
?>
</table>
<input type ="submit" class = "btn btn-danger" name = "delete_cart_item" value = "Delete"></form>
</div>
</div>
<br><br><br><br><br>
<!-- Footer Navigation -->
<nav class="navbar navbar-default">
<div class="container">
<ul class ="list-unstyled">
<li class = "col-md-2"><h5><b>Call Us: (049) 557 2681</b></h5></li>
<li class = "col-md-2"><h5><b><a href = "about.php"><font color = "black">About Us </b></h5></font></a></li>
<li class = "col-md-2"><h5><b><a href = "contact.php"><font color = "black">Contact Us</b></h5></font></a></li>
<li class = "col-md-2"><h5><b><a href = "privacy.php"><font color = "black">Privacy</b></h5></font></a></li>
<li class = "col-md-2"><h5><b><a href = "terms.php"><font color = "black">Terms of Service</b></h5></font></a></li>
<li class = "col-md-2"><h5><b>Copyright (c) 2016<h5></li>
</ul>
</div>
</nav>
<!--
Members:
Marlon Mendoza
Gee Ann Endriga
John Thelman Baldemor
-->
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment