-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpay_fees.php
More file actions
194 lines (169 loc) · 5.45 KB
/
pay_fees.php
File metadata and controls
194 lines (169 loc) · 5.45 KB
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
<?php
session_start();
// Check if fname and lname are set in the session
if (isset($_SESSION['fname']) && isset($_SESSION['lname'])) {
$fname = $_SESSION['fname'];
$lname = $_SESSION['lname'];
} else {
// Redirect to login if session variables are not set
header("Location: login.php");
exit();
}
// Database connection (adjust your username and password accordingly)
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "erp";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Handle form submission
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// Get the fee details
$fee_type = $_POST['fee_type'];
$installment = $_POST['installment'];
$amount = 0;
// Determine the amount based on fee type and installment
if ($fee_type == 'academic') {
if ($installment == 'first') {
$amount = 50000;
} elseif ($installment == 'second') {
$amount = 50000;
}
} elseif ($fee_type == 'transportation') {
if ($installment == 'first') {
$amount = 15000;
} elseif ($installment == 'second') {
$amount = 15000;
}
}
// Store the fee payment in the database
$sql = "INSERT INTO fee_submission (fname, lname, fee_type, installment, amount, payment_date)
VALUES ('$fname', '$lname', '$fee_type', '$installment', '$amount', NOW())";
if ($conn->query($sql) === TRUE) {
$confirmation_message = "Fee for $fee_type ($installment) installment of Rs. $amount has been successfully paid!";
} else {
$confirmation_message = "Error: " . $sql . "<br>" . $conn->error;
}
$conn->close();
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Fee Submission</title>
<style>
/* General Styles */
body {
font-family: 'Segoe UI', Tahoma, sans-serif;
background: url("fee_info.png");
background-size: cover;
background-position: center;
background-repeat: no-repeat;
background-attachment: fixed;
color: #333;
margin: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
/* Card Container */
.container {
background: rgba(255, 255, 255, 0.95);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
border-radius: 12px;
padding: 30px;
max-width: 500px;
width: 90%;
text-align: center;
}
/* Title Styling */
h1 {
color: #1e73be;
font-size: 28px;
text-shadow: 1px 1px 3px rgba(255, 255, 255, 0.8);
}
h2 {
font-size: 20px;
color: #444;
margin-bottom: 20px;
}
/* Form Styling */
form {
display: flex;
flex-direction: column;
gap: 15px;
}
label {
font-size: 16px;
font-weight: 600;
color: #333;
}
/* Adjusting the radio buttons to be side by side */
.radio-group {
display: flex;
justify-content: space-around;
}
.radio-group input[type="radio"] {
margin-right: 10px;
}
input[type="submit"] {
background-color: #1e73be;
color: white;
border: none;
padding: 12px;
font-size: 16px;
cursor: pointer;
border-radius: 6px;
transition: background-color 0.3s ease;
}
input[type="submit"]:hover {
background-color: #15679b;
}
/* Confirmation Message Styling */
p {
color: #388e3c;
font-weight: 600;
margin-top: 20px;
}
</style>
</head>
<body>
<div class="container">
<h1>Welcome, <?php echo $fname . " " . $lname; ?>!</h1>
<h2>Fee Submission</h2>
<?php
if (isset($confirmation_message)) {
echo "<p>$confirmation_message</p>";
}
?>
<form method="POST" action="">
<label for="fee_type">Fee Type:</label>
<div class="radio-group">
<label>
<input type="radio" name="fee_type" value="academic" required> Academic
</label>
<label>
<input type="radio" name="fee_type" value="transportation" required> Transportation
</label>
</div>
<label for="installment">Installment:</label>
<div class="radio-group">
<label>
<input type="radio" name="installment" value="first" required> First Installment
</label>
<label>
<input type="radio" name="installment" value="second" required> Second Installment
</label>
</div>
<input type="submit" value="Pay Fee">
</form>
</div>
</body>
</html>