<form action="patient.php" method="post">




<input id="fiscal_code" type="text" name="fiscal_code" placeholder="Fiscal code" value="<?php echo $result["nome"]; ?> >


<input id="name" type="text" name="name" placeholder="Name">


<input id= "surname" type="text" name="surname" placeholder="Surname">


<input id="date_of_birth" type="text" name="date_of_birth" placeholder="yyyy/mm/dd">


<input id="place_of_birth" type="text" name="place_of_birth" placeholder="Place of birth">


<input id= "city" type="text" name="city" placeholder="City">


<select name="gender" id="gender">
<option value="male">male</option>
<option value="female">female</option>
<option value="other">other</option>
</select>


<input id="submit" type="submit" name="submit" value="submit">
<input id="reset" type="reset" name="reset" value="reset">
<input id="search" type="button" name="search" value="search" onclick="search()">
</form>


<?php

$servername = "localhost";
$username = "root";
$password = "";
$dbname = "vaccinazione";



$conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);




$dati=array(
"name"=>$_POST["name"],
"surname"=>$_POST["surname"],
"fiscal_code"=>$_POST["fiscal_code"],
"date_of_birth"=>$_POST["date_of_birth"],
"place_of_birth"=>$_POST["place_of_birth"],
"city"=>$_POST["city"],
"gender"=>$_POST["gender"]);


$query1 = ("SELECT codicefiscale, nome, cognome, dataNascita, luogoNascita, provincia, sesso from pazienti
where codicefiscale='$dati[fiscal_code]' ");
$statement= $conn ->prepare($query1);
$statement->execute();
$result= $statement->fetch(PDO::FETCH_ASSOC);
?>



questo è il codice che ho utilizzato per prendere i dati dal DB e inserirlo nella form della pagina nuova ma non funziona