I support a database how can I share a variable from one page to another?
My page choose.php when it is loaded generates buttons with a field value of a database table as value. I have to make sure that at the click of the button: - save me a table data ("id") - I am redirected to another page - on the page where I am redirected to get the variable and put it in a query
it's possible? If so how?
<!DOCTYPE html>
<?php 
 session_start();
    if(!isset($_SESSION["username"])){
     header('location: ../index.php');
    }else
    {
    
?>
<?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="#" class="myButton" alt="">' . $row["nomeCantiere"] . '</a>';
      
  
  
    }
 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;
echo $idCantierePerSelect;
$conn->close();
?>For now I only managed to do the automatic loading of the buttons ... and I thought of putting "idCantiere", which is the field that I have to go from table to table, global
 
    