so I have this get request on reservation.php
<h2>Reserveren <?php echo $_GET['naam'];?>
'
on this page I have a form that users can fill in. if they hit submit they go to reservationback.php and this will insert all information in the db
now I want to also insert the ID that corresponds with the $_GET naam (a.k.a name) that I have on reservation.php
how do I do this?
reservationback.php
<?php
include "config.php";
if ($_POST['submit']){
$naam = $_POST['naam'];
$email = $_POST['email'];
$telefoonnummer = $_POST['telefoonnummer'];
$huis_Naam = "huisnaam";
$sql = "INSERT INTO huurder (naam, email, telefoonnummer, huis_Naam) VALUES (?, ?, ?, ?)";
if($stmt = $conn->prepare($sql)){
$stmt->bind_param('ssis', $naam, $email, $telefoonnummer, $huis_Naam);
if(!$stmt->execute())
{
echo 'Het uitvoeren van de query is mislukt: '.$stmt->error.' in query: '.$sql;
}else{
echo "Het uitvoeren was een succes!";
}
}
}else{
echo "random test";
}
What I have tried:
things I tried searching
post my $get to another page php
$_get to another page PHP
I also tried $huis_naam = $_GET['naam']; but that gives undefined array key (obviously because I'm not putting naam in to the url)