-
Notifications
You must be signed in to change notification settings - Fork 4
/
promo_valid.php
29 lines (25 loc) · 998 Bytes
/
promo_valid.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
<?php
require("db.php");
$seatno = $_GET["seatno"];
$inputDepartDate = $_GET['inputdate'];
$scheduleno1 = $_GET['scheduleno'];
$TicketPrice = $_GET['TicketPrice'];
if(isset($_POST['Reedem'])){
$PromoCode = $_POST['PromoCode'];
$promo = mysqli_query($con,"SELECT * FROM promo_code WHERE PromoCode = '$PromoCode' ");
$rows = mysqli_num_rows($promo);
if ($rows==1){
while($rs = mysqli_fetch_array($promo)){
$valid = $rs['PromoCode'];
$ScheduleNo = $rs['ScheduleNo'];
$promopercentage = $rs['PromoPercentage'];
}
}
if($PromoCode==$valid && $scheduleno1 == $ScheduleNo ){
$TotalPrice = $TicketPrice - ($TicketPrice * $valid/100);
header("location: payment.php?seatno=".$seatno."&inputdate=".$inputDepartDate."&scheduleno=".$scheduleno1."&PromoCode=".$PromoCode."&TicketPrice=".$TotalPrice);
}
else
echo"invalid Code";
}
?>