-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathratings.php
195 lines (121 loc) · 5.23 KB
/
ratings.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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
<?php
$PRODUCT_ID=$_GET["PRODUCT_ID"];
session_start();
$link = mysqli_connect("localhost","root","","ecom");
$TEMP1=$_SESSION["CUSTOMER_NAME"];
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>E-commerce</title>
<link rel="stylesheet" href="cart.css" />
<link
rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"
/>
<script>
function valid()
{
if(document.getElementById('PRODUCT_RATING').value >5)
{
alert('Rating should be between 1-5');
return false;
}
else if(document.getElementById('PRODUCT_RATING').value=="")
{
alert('Please Rate The Product');
}
}
</script>
</head>
<body>
<form action="" method="POST">
<div class="container">
<div class="navbar">
<div class="logo">
<img src="./images/Free_Sample_By_Wix.jfif" width="125px" />
</div>
<nav>
<ul>
<li>
<b><a href="logout.php">Home</a></b>
</li>
<li>
<b><a href="Product.php">Products</a></b>
</li>
<li>
<b><a href="cart.php">Cart</a></b>
</li>
<li>
<b><input type="submit" name="sub" value="Logout"></b>
</li>
</ul>
</nav>
</form>
</div>
<!---cart items details-->
<div class="small-container cart-page">
<form name="form2" action="" method="POST" enctype="multipart/form-data" onsubmit="return valid()">
<table>
<tr>
<th>Product</th>
<th> Rating</th>
<th>Rating Description</th>
</tr>
<div class="cart-info">
<td>
<?php
$res=mysqli_query($link,"SELECT PRODUCT_IMAGE FROM product WHERE PRODUCT_ID=$PRODUCT_ID");
while($row=mysqli_fetch_array($res))
{
?>
<img src="<?php echo $row['PRODUCT_IMAGE']?>" height="100" width="100" />
<?php
}
?>
</div>
</div>
</td>
<td> <input type="text" name="PRODUCT_RATING"id="PRODUCT_RATING"></td>
<td>
<textarea cols="20" rows="10" name="RATING_DESC"></textarea>
</td>
</tr>
</table>
<div class="total-price">
<button type="submit" name="submit5" value="Rate" width="100" height="100">Rate</button>
</div>
</form>
</div>
<?php
if(isset($_POST["submit5"]))
{
echo "<script> alert('Thank you for rating the product.Please Continue Shopping ');window.location='Product.php'</script>";
mysqli_query($link,"INSERT INTO ratings VALUES('$_GET[CUSTOMER_ID]','$_POST[PRODUCT_RATING]','$_POST[RATING_DESC]','$_GET[PRODUCT_ID]','$_SESSION[CUSTOMER_NAME]')");
}
?>
<?php
if(isset($_POST["sub"]))
{
?>
<script type="text/javascript">
window.location='index.php';
</script>
<?php
}
?>
<!--Footer-->
<div class="footer">
<div class="row">
<div class="footer-col2">
<img src="./images/Free_Sample_By_Wix.jfif" width="30px" />
<p>
Hope our services have rendered useful. Continue shopping to avail better offers and discounts!!!
</p>
</div>
</div>
</div>
</body>
</html>