-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
107 lines (97 loc) · 3.29 KB
/
Copy pathindex.php
File metadata and controls
107 lines (97 loc) · 3.29 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
<?php
include_once('config.php');
$selectedQuarto = '';
// Verifica se o formulário foi enviado
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['quarto'])) {
$idQuarto = $_POST['quarto'];
} else {
// Se o formulário não foi enviado, define o quarto padrão como 1
$idQuarto = 1;
}
// Busca o nome do quarto selecionado no banco de dados
$stmt = $conexao->prepare("SELECT nome_quarto FROM quarto WHERE id_quarto = ?");
$stmt->bind_param('i', $idQuarto);
$stmt->execute();
$result = $stmt->get_result();
if ($row = $result->fetch_assoc()) {
$selectedQuarto = $row['nome_quarto'];
}
?>
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Vitrine de Quartos</title>
<link rel="stylesheet" href="style.css">
<link rel="icon" href="img/cama.svg">
</head>
<body>
<header>
<div id="titulo">
<a href="index.php">
<h1 id="title">Central</h1>
<p id="p_title">Pousada do Vale Sereno</p>
</a>
</div>
<div>
<nav>
<a class="link_nav" href="login.php">Login</a>
<a class="link_nav" href="cadastro.php">Cadastre-se</a>
</nav>
</div>
</header>
<div class="vitrine">
<!-- <form id="busca_vitrine" method="POST" action="index.php">
<select name="quarto" id="quarto">
<?php
$querry = $conexao->query(
"SELECT
quarto.id_quarto AS id,
quarto.nome_quarto AS quarto
FROM
quarto
ORDER BY
id ASC");
$registros = $querry->fetch_all(MYSQLI_ASSOC);
foreach($registros as $option) {
?>
<option value="<?php echo $option['id']?>">
<?php echo $option['quarto']?>
</option>
<?php
}
?>
</select>
<button type="submit" class="pesquisa">Buscar</button>
</form>
<br>
<?php
if (!empty($selectedQuarto)) {
echo "<h3>Quarto selecionado: " . htmlspecialchars($selectedQuarto) . "</h3>";}
?> -->
<div class="todos_quartos">
<?php
$querry = $conexao->query(
"SELECT
quarto.id_quarto AS id,
quarto.nome_quarto AS quarto
FROM
quarto
ORDER BY
id ASC");
$registros = $querry->fetch_all(MYSQLI_ASSOC);
foreach($registros as $option) {
?>
<div class="quarto">
<p value="<?php echo $option['id']?>">
<?php echo $option['quarto']?>
</p>
</div>
<?php
}
?>
</div>
</div>
</body>
</html>