-
Notifications
You must be signed in to change notification settings - Fork 0
/
payment.php
181 lines (155 loc) · 5.32 KB
/
payment.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
<?php
include ('header.php');
$user_data = check_login($con);
$tour_id = $_GET['tour_id'] ?? '';
$persons = $_GET['persons'] ?? '';
$total_price = $_GET['total_price'] ?? '';
$user_name = $user_data['user_name'];
session_start();
$_SESSION['user_name'] = $user_name;
$_SESSION['total_price'] = $total_price;
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Payment Details</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
margin: 0;
padding: 0;
}
.container {
max-width: 800px;
margin: 50px auto;
background-color: #fff;
padding: 20px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
border-radius: 10px;
}
.container h2 {
text-align: center;
margin-bottom: 20px;
color: #333;
}
.details {
border-top: 1px solid #ddd;
padding-top: 15px;
margin-top: 15px;
}
.details p {
display: flex;
justify-content: space-between;
padding: 10px 0;
border-bottom: 1px solid #eee;
}
.details p:last-child {
border-bottom: none;
}
.form-container {
margin-top: 20px;
}
label {
display: block;
margin-bottom: 5px;
}
select, input[type="text"], input[type="number"], input[type="submit"] {
width: 100%;
padding: 10px;
margin-top: 5px;
border: 1px solid #ddd;
border-radius: 5px;
font-size: 16px;
}
input[type="submit"] {
cursor: pointer;
background-color: #28a745;
color: white;
border: none;
margin-top: 10px;
}
input[type="submit"]:hover {
background-color: #218838;
}
#card_payment, #mobile_banking_payment {
display: none;
}
table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
}
table, th, td {
border: 1px solid #ddd;
text-align: center;
padding: 8px;
}
th {
background-color: #f2f2f2;
}
</style>
</head>
<body>
<div class="container">
<h2>Payment Details</h2>
<div class="details">
<p><strong>User Name:</strong> <span><?php echo htmlspecialchars(ucfirst($user_name)); ?></span></p>
<p><strong>Total Price:</strong> <span><?php echo htmlspecialchars($total_price); ?> TK</span></p>
</div>
<div class="form-container">
<form id="payment_form" action="gene_pdf.php" method="post">
<label for="payment_method">Payment Method:</label>
<select id="payment_method" name="payment_method" required>
<option value="">Select</option>
<option value="card">Credit/Debit Card</option>
<option value="mobile_banking">Mobile Banking</option>
</select>
<div id="card_payment">
<label for="card_number">Card Number:</label>
<input type="text" id="card_number" name="card_number">
<label for="card_expiry">Expiry Date (MM/YY):</label>
<input type="text" id="card_expiry" name="card_expiry">
<label for="card_cvc">CVC:</label>
<input type="text" id="card_cvc" name="card_cvc">
</div>
<div id="mobile_banking_payment">
<label for="mobile_banking_number">Mobile Banking Number:</label>
<input type="text" id="mobile_banking_number" name="mobile_banking_number">
<label for="transaction_id">Transaction ID:</label>
<input type="text" id="transaction_id" name="transaction_id">
</div>
<input type="submit" value="Make Payment">
</form>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function () {
const paymentMethodSelect = document.getElementById('payment_method');
const cardPaymentDiv = document.getElementById('card_payment');
const mobileBankingDiv = document.getElementById('mobile_banking_payment');
paymentMethodSelect.addEventListener('change', function () {
if (this.value === 'card') {
cardPaymentDiv.style.display = 'block';
mobileBankingDiv.style.display = 'none';
} else if (this.value === 'mobile_banking') {
cardPaymentDiv.style.display = 'none';
mobileBankingDiv.style.display = 'block';
} else {
cardPaymentDiv.style.display = 'none';
mobileBankingDiv.style.display = 'none';
}
});
document.getElementById('payment_form').addEventListener('submit', function (event) {
event.preventDefault();
alert("Payment is being processed. Please wait...");
setTimeout(function () {
document.getElementById('payment_form').submit();
}, 1000);
});
});
</script>
</body>
</html>