-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathChoose-book.php
More file actions
159 lines (159 loc) · 5.83 KB
/
Copy pathChoose-book.php
File metadata and controls
159 lines (159 loc) · 5.83 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login In</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
<style>
body, html {
height: 100vh;
width: 100%;
}
/* Start out */
.domain-search {
margin: 0;
padding: 105px 0;
}
.domain-search .form-title {
margin-top: 0;
margin-bottom: 2px;
color: #fff;
font-family: "Poppins", sans-serif;
font-weight: 100
}
.domain-search p {
color: #B0E7FF;
margin: 0
}
.domain-search .input-group {
-webkit-box-shadow: 0px 4px 18px 0px rgba(0, 0, 0, 0.1);
box-shadow: 0px 4px 18px 0px rgba(0, 0, 0, 0.1)
}
.domain-search .input-group-addon {
border: none
}
.domain-search .form-title strong {
display: block
}
.domain-search .form-control {
height: 60px;
border-radius: 0;
border: none
}
.domain-search .form-control:focus {
box-shadow: 0px 0px 0px 0px #ffffff !important
}
.input-group .input-group-addon [type="submit"],
.input-group .input-group-addon button {
border: none;
border-radius: 0
}
.domain-search .btn {
padding: 0 54px;
line-height: 60px
}
.btn-primary {
padding: 0 28px;
line-height: 54px;
background: #ff6726;
color: #fff
}
.btn-primary:hover {
color: #fff;
}
.domain-search .input-group+p {
color: #fff;
font-size: 15px;
font-family: "Poppins", sans-serif;
font-weight: 100;
margin-top: 15px;
margin-bottom: 0
}
.domain-search .input-group+p strong {
margin-right: 40px
}
/* Over Out */
.card {
background-color: rgba(255, 255, 255, 0.699);
color: rgb(126, 0, 0);
padding: 15px;
margin-top: 104px;
height: auto;
}
.imgg {
background-image: url("img/bg-choose-book.jpg");
opacity: 0.6;
/* background-color: #cccccc0e; */
height: 100vh;
width: 100%;
background-repeat: no-repeat;
background-size: cover;
}
</style>
</head>
<body>
<div class="imgg">
<!-- This Button -->
<form class="row domain-search bg-pblue" action="Choose-book.php" method = "POST" >
<div class="container">
<div class="row">
<div class="col-md-3">
<h2 class="form-title">Find Your <strong>Favourit Books</strong></h2>
<p>“Today a reader, tomorrow a leader.”</p>
</div>
<div class="col-md-9">
<div class="input-group"> <input type="txt" name = "BookName" placeholder="“If you don’t like to read, you haven’t found the right book. ” "list="books" class="form-control"> <span class="input-group-addon"><input type="submit" value="Search" class="btn btn-primary"> <
</span>
</div>
<p>Libary <strong>$0.0</strong>per/Day <strong>$1.95</strong>Buy <strong>$9.95</strong>Fine <strong>$4.99</strong></p>
</div>
</div>
</div>
</form>
<?php
session_start();
if(empty($_SESSION['name'])){
header("location: login.php");
}
$user = 'root
$password = '';
$database = 'LMS';//or which one U create that name
$mysql = new mysqli("localhost", $user,
$password, $database);
$sql = "SELECT * FROM book";
echo ' <datalist id="books"> ';
if ($result = $mysql->query($sql)) {
while ($row = $result->fetch_assoc()) {
echo '<option value="'.$row["Name"].'"></option><br><small><p>'.$row["Auther"].'</p></small></option>';
}}
echo '</datalist>';
if(isset($_POST['BookName'])){
echo '<script>alert("'.$_POST["BookName"].'")</script>';
$sqla = 'SELECT * FROM book where Name= "'.$_POST["BookName"].'";' ;
if ($result = $mysql->query($sqla)) {
$row = $result->fetch_assoc( );
session_start();
$_SESSION['Book'] = $row["Name"];
$_SESSION['Auther'] = $row["Auther"];
echo '
<center>
<div class="col-sm-3 d-flex justify-content-center">
<div class="card card-block">
<div class="card-block">
<center><h4 class="card-title">'.$row["Name"].'</h4></center>
<center><h6 class="card-subtitle text-muted">'.$row["Auther"].'</h6></center>
<center><p class="card-text">'.$row["about"].'</p></center>
<center><a href="book-buy.php" style="align-content: center;" class="btn btn-primary">Read Now</a></center>
</div>
</div>
</div>
</div><center>';
}
}
?>
</div>
</body>
</html>