-
Notifications
You must be signed in to change notification settings - Fork 0
/
perguntas.php
55 lines (47 loc) · 1.61 KB
/
perguntas.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
44
45
46
47
48
49
50
51
52
53
54
55
<?php
include "conexao.php";
include "header.php";
if(isset($_POST) && !empty($_POST)){
$pergunta = $_POST['pergunta'];
$query = "INSERT INTO perguntas (pergunta) VALUES ('$pergunta')";
$resultado = mysqli_query($conexao, $query);
}
$query = "select * from perguntas";
$resultado = mysqli_query($conexao, $query);
?>
<body style="background-color: #D8BFD8;">
<div class="col-7 mt-5 mx-auto bg-light border rounded container-fluid">
<div class="mx-auto mt-3" style="width: 40%">
<h3 >Cadastro De Perguntas</h3>
</div>
<form class="table table-hover table-striped mx-auto mt-3" style="width: 65%" action="perguntas.php" method="post">
<div>Digite aqui a sua pergunta:</div>
<input class="form-control" type="text" name="pergunta"/>
<br>
<div class="d-flex">
<button type="submit" class="btn btn-success">Salvar</button>
</div>
<br>
</form>
<table class="table table-hover table-striped mx-auto" style="width: 65%">
<thead>
<tr>
<th>ID</th>
<th>Pergunta</th>
<th></th>
</tr>
</thead>
<tbody>
<?php while($linha = mysqli_fetch_array($resultado))
{
echo "<tr>";
echo "<td>".$linha['id']."</td>";
echo "<td>".$linha['pergunta']."</td>";
echo"<td><button type='button' class='ms-5 btn btn-warning'><a href='./alternativas.php?pergunta_id=".$linha['id']." 'style='text-decoration:none; color: white'>Alternativas</a></button></td>";
echo "</tr>";
}
?>
</tbody>
</table>
</div>
</body>