-
Notifications
You must be signed in to change notification settings - Fork 0
/
ChildSavingsAccount.php
54 lines (51 loc) · 1.58 KB
/
ChildSavingsAccount.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
<?php
session_start();
if (!isset($_SESSION['User'])& empty($_SESSION['User'])) {
header('location: Login.php');
}?>
<!DOCTYPE html>
<html>
<body>
<?php
if(isset($_POST) & !empty($_POST) ){
function test_input($data) {
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
$AccountNumber=test_input($_POST['AccountNumber']);
$firstname=test_input($_POST['firstname']);
$middlename=test_input($_POST['middlename']);
$lastname=test_input($_POST['lastname']);
$DOB=test_input($_POST['DOB']);
$Gender=test_input($_POST['Gender']);
$conn = mysqli_connect("localhost", "root", "","Bank");
$stmt = $conn->prepare("INSERT INTO Child_Savings_Account(Account_No,First_Name,Middle_Name,Last_Name,DOB,Gender) VALUES (?,?,?,?,?,?)");
$stmt->bind_param("isssss",$AccountNumber,$firstname,$middlename,$lastname,$DOB,$Gender);
if ($stmt->execute() === TRUE) {
echo "<h1>Child Savings account created successfully</h1>";
include 'ViewAccountDetailsFunction.php';
ViewAccountDetails($AccountNumber,$conn);
}else{
echo "Error updating record: " . $conn->error;
}
}
$stmt->close();
mysqli_close($conn);
unset($_SESSION['NIC_arr']);
unset($_SESSION['Other_branches']);
unset($_SESSION['Customer_Str']);
unset($_SESSION['Primary_Customer']);
?>
<br>
<button onclick="myFunction()">Print this page</button>
<br><br>
<button onclick="window.location.href = 'home.php';">Home</button>
<script>
function myFunction() {
window.print();
}
</script>
</body>
</html>