how can I redirect the user to another php page based on the button he is pressing? For example .. I want that once loaded the page, in it are generated buttons containing the "id" of the table taken from a database ... At the click of the button you are redirected to a page in which there are textbox with the fields belonging to the table id ..
<?php
$servername = "localhost";
$username = "";
$password = "";
$dbname = "";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT idCantiere,nomeCantiere,codiceCommessa,indirizzoCantiere FROM Cantiere";
$result = $conn->query($sql);
echo'<h1> <font face="verdana" color="green">Quale Cantiere desideri Modificare?</font> </h1>';
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo'<br><br><br>';
echo'<a href="#" onClick=navigaButton(); class="myButton" alt="">' . $row["nomeCantiere"] . '</a>';
// echo '<a href="#" class="rainbow-button" alt="' . $row["nomeCantiere"] . '"></a>';
//''<input type="button" value="' . $row["nomeCantiere"] . '" />'
}
echo'<br><br><br>';
echo '<a href="../pagineHtml/inserimento/inserimentoGenerale/inserimentoCantiere.php" class="myButton" alt="Nuovo Cantiere +">Nuovo Cantiere +</a>';
} else {
echo "0 results";
}
$idCantierePerSelect = $_POST["idCantiere"];
global = $idCantierePerSelect;
function navigaButton()
{
// FUNCTION That redirect to the page
};
$conn->close();
?>
So I have to pick up the "idCantiere" and I have to make sure that by clicking on the button on the page that opens me there are textBox with the data of the table of the "idCantiere"
navigaButtonwould need to be javascript and you would need to pass it the id somehow.