-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnewborrower.php
130 lines (117 loc) · 3.66 KB
/
newborrower.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
<!DOCTYPE html>
<html lang="en">
<head>
<title>Library</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="assets/css/bootstrap.min.css">
<link rel="stylesheet" href="assets/css/style1.css">
<script src="assets/js/bootstrap.min.js"></script>
<script src="assets/js/jquery-3.2.1.min.js"></script>
</head>
<div class="container-fluid">
<div class="row title-row">
<div class="col-md-12">
<p class="page-title">My Library</p>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<nav class="navbar navbar-default">
<div class="container-fluid">
<ul class="nav navbar-nav">
<li><a href="index.php">Home</a></li>
<li><a href="check-dues.php">Check For Dues</a></li> <!-- Add new li for new page and page link in href -->
<!--- <li><a href="book-issue.php">Issue a book</a></li> -->
<li><a href="checkin.php">Checkin a book</a></li>
<li class="active"><a href="newborrower.php">Register new borrower</a></li>
</ul>
</div>
</nav>
<div class="row content-row">
<div class="col-md-12">
<p class="content-title">Register new borrower</p>
</div>
<div class="col-md-12">
<form method="post" class="dues">
<p align="center">
<table>
<tr>
<td>
<label>Name: </label>
</td>
<td>
<input type="text" name="name">
</td>
</tr>
<tr>
<td>
<label>SSN: </label>
</td>
<td>
<input type="text" name="ssn">
</td>
</tr>
<tr>
<td>
<label>Address: </label>
</td>
<td>
<input type="text" name="address">
</td>
</tr>
<tr>
<td>
<label>Phone: </label>
</td>
<td>
<input type="text" name="phone">
</td>
</tr>
</table>
<p align="center">
<input type="submit" name="register" value="Register"></p>
</form>
</div>
<?php
include 'assets/connect.php';
if(isset($_POST['register']))
{
if(!empty($_POST['name']) && !empty($_POST['ssn']) && !empty($_POST['address']) && !empty($_POST['phone']))
{
$n = $_POST['name'];
$s = $_POST['ssn'];
$a = $_POST['address'];
$p = $_POST['phone'];
$sql = "select max(card_id) as new from borrower";
$result=mysqli_query($db,$sql);
$row = mysqli_fetch_array($result);
$i = $row['new'];
$i=$i+1;
$sql2 = "insert into borrower values('$i','$s','$n','$a','$p')";
$r = mysqli_query($db,$sql2);
if($r)
{
//echo "Borrower successfully registered!!!";
echo "<div align='center' style ='font:30px/21px Arial,tahoma,sans-serif;color:#ff0000'>Borrower successfully registered!!!</div>";
}
else
{
//echo "SSN already exists!!!";
echo "<div align='center' style ='font:30px/21px Arial,tahoma,sans-serif;color:#ff0000'> SSN already exists!!!</div>";
}
}
else
{
echo "<div align='center' style ='font:30px/21px Arial,tahoma,sans-serif;color:#ff0000'> Enter all fields!!!</div>";
}
}
?>
<div class"col-md-12">
</div>
</div>
</div>
</div>
</body>
</html>