-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsupplements.php
131 lines (102 loc) · 3.73 KB
/
supplements.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<?php
session_start();
include 'custdashboardh.php';
error_reporting(E_PARSE | E_ERROR);
$conn=mysqli_connect('localhost','root','','majorpharma');
$status="";
if (isset($_POST['code']) && $_POST['code']!=""){
$code=$_POST['code'];
echo "name in post=".$code;
$result = mysqli_query($conn,"select * from add_product where categary='a'");
if(mysqli_query($conn,"select * from add_product where name='$categary'"))
{echo " ;;;;;;;;connect";}
else{ echo "not connect";}
echo "select * from add_product where categary='a'";
$row = mysqli_fetch_assoc($result);
//$name = $row['name'];
$code = $row['name'];
//echo "Access".$code;
//echo $row['name'];
$price =$row['mrp'];
//echo " price ".$row['mrp'];
$image = $row['image'];
$q=$_POST['quantity'];
//echo "price is".$q;
$cartArray = array(
$code=>array(
'code'=>$code,
'price'=>$price,
'quantity'=>$_POST['quantity'],
'image'=>$image)
);
if(empty($_SESSION["shopping_cart1"])) {
$_SESSION["shopping_cart1"] = $cartArray;
$status = "<div class='box'>Product is added to your cart!</div>";
}else{
$array_keys = array_keys($_SESSION["shopping_cart1"]);
if(in_array($code,$array_keys)) {
$status = "<div class='box' style='color:red;'>
Product is already added to your cart!</div>";
} else {
$_SESSION["shopping_cart1"] = array_merge($_SESSION["shopping_cart1"],$cartArray);
$status = "<div class='box'>Product is added to your cart!</div>";
}
}
}
?>
<link href="https://fonts.googleapis.com/css?family=Rubik:400,700|Crimson+Text:400,400i" rel="stylesheet">
<link rel="stylesheet" href="fonts/icomoon/style.css">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/magnific-popup.css">
<link rel="stylesheet" href="css/jquery-ui.css">
<link rel="stylesheet" href="css/owl.carousel.min.css">
<link rel="stylesheet" href="css/owl.theme.default.min.css">
<link rel="stylesheet" href="css/aos.css">
<link rel="stylesheet" href="css/style.css">
<link rel='stylesheet' href='css/style1.css' type='text/css' media='all' />
<?php
if(!empty($_SESSION["shopping_cart1"])) {
$cart_count = count(array_keys($_SESSION["shopping_cart1"]));
?>
<div class="cart_div">
<a href="cartnew.php"><img src="cart-icon.png" /> Cart<span><?php echo $cart_count; ?></span></a>
</div>
<?php
}
$res=mysqli_query($conn,"select * from add_product where categary='a'");
while($row=mysqli_fetch_array($res))
{
?>
<!--<<div class="container">
<div class="row">
<div class="col-md-3 col-sm-6">
<span class="tag">Sale</span>
<div style="width:700px; margin:50 auto;">-->
<div class='product_wrapper'>
<form method='post' action=''>
<input type='hidden' name='code' value="<?php echo $row["name"];?>" />
<input type='hidden' name='categary' value="<?php echo $row["categary"];?>" />
<a href="shop-single.html"> <img src="<?php echo $row["image"]?>" alt="Image" width="200px" height="200px"></a>
<h3 class="text-dark"><a href="shop-single.html"><?php echo $row["name"];?></a></h3>
<p class="price"> — $<?php echo $row["mrp"];?></p>
<p class="price"> — MF Date <?php echo $row["mfg"];?></p>
<p class="price"> — Exp Date <?php echo $row["exp"];?></p>
<p>
<input type='text' name='quantity' value="" /></p>
<button type='submit' class="btn btn-primary px-5 py-3" >Buy Now</button>
<!--<p>
<a href="cartnew.php" class="btn btn-primary px-5 py-3">Buy Now</a>
</p>-->
<p> <?php echo $row["descripsion"]; ?> </p>
</form>
</div>
<?php
}
?>
<div style="clear:both;"></div>
<div class="message_box" style="margin:10px 0px;">
<?php echo $status; ?>
</div>
<?php
include 'custdashboard.php';
?>