1
I want to make a system similar to a page posting, where, when clicking a button of the specific div, the user will be redirected to a page with information related to that object. However, I am having problems with this redirection, because I don’t know how to assign a specific value to the variable that returns only the information from a database row, occurring - when clicking - the sampling of all data from all rows and columns of the database.
I thought about solving the problem as follows: by clicking the div button, the script will assign a value to a variable, which should be equal to the id value of the post in the database, in order to limit the results, but I cannot create that button.
This is the communication information with the database, and the information I want to return:
include("conectar.php");
$consulta = "SELECT id, nome, sexo, idade FROM teste
where id = '3'";
$con = $mysqli->query($consulta) or die($mysqli->error);
And this is the table that should return the information:
<tr class="header">
<th style="width:10%;">ID</th>
<th style="width:60%;">Nome Completo</th>
<th style="width:10%;">Sexo</th>
<th style="width:10%;">Idade</th>
<th style="width:10%;">Acesso</th>
</tr>
<?php while($dado = $con->fetch_array()){ ?>
<tr>
<td><?php echo $dado["id"]; ?></td>
<td><?php echo $dado["nome"]; ?></td>
<td><?php echo $dado["sexo"]; ?></td>
<td><?php echo $dado["idade"]; ?></td>
<td><a href="teste/pagina1.php"><div class="acesso">Acessar</div></a></td>
</tr>
<?php } ?>
</table>
Could someone help me?