<?php require __DIR__.'/../../inc/bootstrap.php'; $id=(int)($_GET['id']??0);
$stmt=$pdo->prepare("SELECT id, nombre, rut, especialidad, direccion, telefono FROM doctores WHERE id=?"); $stmt->execute([$id]); $r=$stmt->fetch();
if(!$r){ http_response_code(404); echo 'No encontrado'; exit; } ?>
<!doctype html><html lang='es'><head>
<meta charset='utf-8'><meta name='viewport' content='width=device-width,initial-scale=1'>
<link rel='stylesheet' href='../../assets/styles.css'>
<link rel='stylesheet' href='../../assets/theme.css'>
<title>Editar doctor</title></head><body>
<div class='container'><div class='card theme-doc'>
<a class='btn' href='index.php'>&larr; Volver</a>
<h2>Editar doctor</h2>
<form method='post' action='update.php?id=<?= (int)$r['id'] ?>'>
<div class='grid' style='grid-template-columns: repeat(2,1fr); gap:12px'>
<div><div class='label'>Nombre</div><input class='input' type='text' name='nombre' value='<?=h($r["nombre"])?>'></div><div><div class='label'>RUT</div><input class='input' type='text' name='rut' value='<?=h($r["rut"])?>'></div><div><div class='label'>Especialidad</div><input class='input' type='text' name='especialidad' value='<?=h($r["especialidad"])?>'></div><div><div class='label'>Dirección</div><input class='input' type='text' name='direccion' value='<?=h($r["direccion"])?>'></div><div><div class='label'>Teléfono</div><input class='input' type='text' name='telefono' value='<?=h($r["telefono"])?>'></div>
</div>
<div style='margin-top:12px'><button class='btn' type='submit'>Guardar cambios</button></div>
</form>
</div></div></body></html>
