-
Notifications
You must be signed in to change notification settings - Fork 1
/
ver_receta.php
43 lines (40 loc) · 1.27 KB
/
ver_receta.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
<?php
include 'db_connect.php';
if (isset($_GET['id'])) {
$id = intval($_GET['id']);
$sql = "SELECT * FROM recetas WHERE id = ?";
$stmt = $conn->prepare($sql);
$stmt->bind_param("i", $id);
$stmt->execute();
$result = $stmt->get_result();
$receta = $result->fetch_assoc();
} else {
echo "Receta no encontrada.";
exit();
}
?>
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?php echo htmlspecialchars($receta['nombre']); ?></title>
</head>
<body>
<h1><?php echo htmlspecialchars($receta['nombre']); ?></h1>
<img src="uploads/<?php echo htmlspecialchars($receta['imagen']); ?>" alt="Imagen de la receta">
<p><?php echo htmlspecialchars($receta['descripcion']); ?></p>
<h2>Ingredientes</h2>
<p><?php echo nl2br(htmlspecialchars($receta['ingredientes'])); ?></p>
<h2>Instrucciones</h2>
<p><?php echo nl2br(htmlspecialchars($receta['instrucciones'])); ?></p>
<h2>Ventajas Nutricionales</h2>
<p><?php echo nl2br(htmlspecialchars($receta['ventajas'])); ?></p>
<h2>Desventajas Nutricionales</h2>
<p><?php echo nl2br(htmlspecialchars($receta['desventajas'])); ?></p>
</body>
</html>
<?php
$stmt->close();
$conn->close();
?>