-
Notifications
You must be signed in to change notification settings - Fork 0
/
pay.php
77 lines (71 loc) · 2.25 KB
/
pay.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
<!DOCTYPE html>
<html lang="en">
<head>
<title>Car Purchasing</title>
<link rel="stylesheet" type="text/css" href="style/reset.css">
<link rel="stylesheet" type="text/css" href="style/responsive.css">
</head>
<body>
<section class="">
<?php
include 'header.php';
?>
</section>
<section class="listings">
<div class="wrapper">
<h3 style="text-decoration: underline">Make Payments Here</h3>
<?php
$cost=$_SESSION['price'];
echo "Total Payment Cost = Rs.".$cost."<br>"."<br>";
?>
<form method="post">
<table>
<tr>
<td>TRANSACTION ID:</td>
<td><input type="text" name="transaction" required></td>
</tr>
<tr>
<td><br>PIN NUMBER:</td>
<td><br><input type="password" name="pin" required></td>
</tr>
<tr>
<td colspan="2" style="text-align:right"><input type="submit" name="pay" value="Submit Details"></td>
</tr>
</table>
</form>
</div>
</section>
<?php
if(isset($_POST['pay'])){
session_start();
include 'connection.php';
$transaction = $_POST['transaction'];
$pin = $_POST['pin'];
$sql="select count(*) as count from supplier";
$res = $conn->query($sql);
while($rws = $res->fetch_assoc()){
$max=$rws['count'];
}
$supplier=rand(1,$max);
$oid=$_SESSION['oid'];
$d=strtotime("+3 Months");
$date = date("Y/m/d",$d);
$_SESSION['ddate']=$date;
$qry ="INSERT INTO purchase_order (Order_No,Supplier_id,Supplier_Delivery_Date,Transaction_id,Pin)
VALUES('$oid','$supplier','$date','$transaction','$pin')";
$result = $conn->query($qry);
if($result == TRUE){
echo "<script type = \"text/javascript\">
alert(\"Payment Successfully Done.\");
window.location = (\"receipt.php\")
</script>";
} else{
echo "<script type = \"text/javascript\">
alert(\"Registration Failed. Try Again\");
window.location = (\"pay.php\")
</script>";
}
}
?>
</body>
</html>