0
<form class="form" method="POST"action="processa_livro.php">
<table class="table table-bordered">
<thead>
<tr>
<th>Nome</th>
<th>Autor</th>
<th>Categoria</th>
<th>Ação</th>
</tr>
</thead>
<tbody id="myTable">
<?php echo "<tr>"?>
<?php echo"<td>". $list_livro['nome']."</td>"?>
<?php echo"<td>". $list_livro['autor']."</td>"?>
<?php echo"<td>". $list_livro['categoria']."</td>"?>
<td>
<input type="image" name="submit" src="img/alter.png" value="alterar" style="width:20px;">
<input type="image" name="submit" src="img/deletar.png" value="deletar" style="width:20px;">
</td>
<?php echo"</tr>"?>
</table>
</form>
php.
<?php
include_once("conexao.php");
$nome = $_POST['nome'];
$autor = $_POST['autor'];
$categoria = $_POST['categoria'];
$sql = "insert into livro (nome, autor, categoria) values ('$nome', '$autor','$categoria')";
$cadastrar = mysqli_query($conexao, $sql);
$list = "SELECT nome, autor, categoria FROM livro";
$list_livro = mysqli_query($conexao, $list);
mysqli_close($conexao);
?>
I’m taking this exit. Could someone point the way so I can be tidying up?
Within the body of your table you try to display data from a variable
$list_livro
that is not defined.– Woss
$list_livro
only exists in the archiveprocessa_livro.php
, are you importing the file? tries to add<?php include_once('processa_livro.php') ?>
before the table in html.– edson alves
I include the $list_book variable in process_book.php. From this it would not read automatically?
– user138346
@edsonalves This would give other errors, because the file would receive a GET request, but only treats the POST request. Maick, no, they’re different files with different scopes.
– Woss