Implement user searching
This commit is contained in:
22
src/user.php
22
src/user.php
@@ -9,6 +9,9 @@
|
||||
<link rel="stylesheet" href="../static/style.css" type="text/css" media="screen" />
|
||||
</head>
|
||||
<body>
|
||||
<div style="text-align: right; margin-top: 20px;">
|
||||
<a href="forms/user_create_form.html" class="create_btn" >Crear</a>
|
||||
</div>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -23,7 +26,13 @@
|
||||
include 'database.php';
|
||||
|
||||
$pdo = connectDatabase();
|
||||
$list = listUsers($pdo);
|
||||
|
||||
if (isset($_GET["search"])) {
|
||||
$list = findUser($pdo, $_GET["search"]);
|
||||
} else {
|
||||
$list = listUsers($pdo);
|
||||
}
|
||||
|
||||
foreach($list as $row) :
|
||||
if(!$row[5]):
|
||||
?>
|
||||
@@ -43,8 +52,15 @@
|
||||
<?php endforeach ?>
|
||||
<?php closeDatabase($pdo); ?>
|
||||
</table>
|
||||
<div style="text-align: right;">
|
||||
<a href="forms/user_create_form.html" class="create_btn" >Crear</a>
|
||||
<div>
|
||||
<form method="post" action="user_management.php">
|
||||
<div class="search-group">
|
||||
<input type="text" name="search_box" value="">
|
||||
</div>
|
||||
<div class="input-group">
|
||||
<button class="btn" type="submit" name="search" >Buscar</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user