0
<?php
include("header.php");
include_once "Classe.php";
?>
<?php
$Ano = $_POST["Ano"];
$Estado = $_POST["Estado"];
$N_arvores_cortadas = $_POST["N_arvores_cortadas"];
$Volume = $_POST["Volume"];
$con = new mysqli("localhost","root",null,"calculo");
$con->query("INSERT INTO cal
(Ano,Estado,N_arvores_cortadas,Volume,arvore_repor,valor_pagar)
VALUES ('$Ano','$Estado','$N_arvores_cortadas','$Volume','$arvore_repor','$valor_pagar')");
?>
<div class="alert alert-primary" role="alert">
Gravado com Sucesso!
</div>
<a href="CalculadoraReflorestamento.php">Cadastrar</a>
<a align="left"><h3><font color='blue'>Valor R$ = 300</font></h3></a>
<table class="table">
<thead class="thead-dark">
<tr>
<th scope="col">Ano</th>
<th scope="col">Estado</th>
<th scope="col">Nº arvores cortadas</th>
<th scope="col">Volume(m³)</th>
<th scope="col">Árvores a
Repor </th>
<th scope="col">Valor a ser
pago </th>
</tr>
</thead>
<tbody>
<?php
$con = new mysqli("localhost","root",null,"calculo");
$r = $con->query("SELECT Ano,Estado,N_arvores_cortadas,Volume,arvore_repor,valor_pagar FROM cal");
while ($l = $r->fetch_assoc()) {
echo "
<tr>
<th scope='row'><font color='white'><h3>$l[Ano]</h3></font></th>
<td ><font color='white'><h3>$l[Estado]</h3></font></td>
<td><font color='white'><h3>$l[N_arvores_cortadas]</h3></font></td>
<td><font color='white'><h3>$l[Volume]</h3></font></td>
<td><font color='white'><h3>$l[arvore_repor]</h3></font></td>
<td><font color='white'><h3>$l[valor_pagar]</h3></font></td>
</tr>
";
echo "$Estado";
}
?>
Hello Hernandez, the problem is that the variables you are using in your query have not been declared.
– Andrei Coelho
where I must declare them?
– Hernandes