List users from database

This commit is contained in:
2020-06-16 22:50:35 +02:00
parent bb1b2f077b
commit 29c6d7bb6d
6 changed files with 109 additions and 71 deletions

79
src/user.php Normal file
View File

@@ -0,0 +1,79 @@
<!doctype html>
<html class="no-js" lang="es">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>Gestión de usuarios</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../static/style.css" type="text/css" media="screen" />
</head>
<body>
<!--[if lt IE 8]>
<p class="browserupgrade">
You are using an <strong>outdated</strong> browser. Please
<a href="http://browsehappy.com/">upgrade your browser</a> to improve
your experience.
</p>
<![endif]-->
<table>
<thead>
<tr>
<th>Nombre</th>
<th>Usuario</th>
<th>Rol</th>
<th>Correo</th>
<th colspan="2">Acciones</th>
</tr>
</thead>
<?php
include 'database.php';
$pdo = connectDatabase("practica", "practica", "practica");
$list = listUsers($pdo);
foreach($list as $row) :
?>
<tr>
<td><?php echo $row[0]; ?></td>
<td><?php echo $row[1]; ?></td>
<td><?php echo $row[2]; ?></td>
<td><?php echo $row[3]; ?></td>
<td>
<a href="index.php?edit=" class="edit_btn" >Editar</a>
</td>
<td>
<a href="server.php?del=" class="del_btn">Borrar</a>
</td>
</tr>
<?php endforeach ?>
</table>
<form method="post" action="user_management.php">
<div class="input-group">
<label>Nombre</label>
<input type="text" name="nombre" value="">
</div>
<div class="input-group">
<label>usuario</label>
<input type="text" name="usuario" value="">
</div>
<div class="input-group">
<label>contraseña</label>
<input type="password" name="contraseña" value="">
</div>
<div class="select-input">
<label>rol</label>
<select id="rol" name="rol">
<option value="1">administrativo</option>
<option value="2">médico</option>
</select>
</div>
<div class="input-group">
<label>correo</label>
<input type="text" name="correo" value="">
</div>
<div class="input-group">
<button class="btn" type="submit" name="submit" >Guardar</button>
</div>
</form>
</body>
</html>