This is the code to submit the form and store it in the database I want to show the form details in another page after submitting
if(isset($_POST['submit']))
{
$pickup = $_POST['pickup'];
$dropoff = $_POST['dropoff'];
$from_date = $_POST['fromdate'];
$to_date = $_POST['todate'];
$diff = date_diff($from_date, $to_date);
//$difff = $diff->format("%a"). " Days ";
if($from_date < $to_date)
{
//$_SESSION['diff'] = $diff->format("a%");
//Create SQL Query
$sql = "INSERT INTO search SET
pickup='$pickup',
dropoff='$dropoff',
from_date='$from_date',
to_date='$to_date',
diff='$diff'
";
//Execute the Query
$res = mysqli_query($conn, $sql);
//Check whether query executed successfully or not
// header('location:'.SITEURL.'list.php');
if($res==true)
{
//Query Executed and booking saved
$_SESSION['booking'] = "<div class='success text-center' style='font-size: 18px'>Vehicle Booked Successfully.</div>";
header('location:'.SITEURL.'list.php');
}
else
{
//Failed to save booking
$_SESSION['booking'] = "<div class='error text-center' style='font-size: 18px'>Failed to Search Vehicles.</div>";
header('location:'.SITEURL);
}
}
else {
$_SESSION['date'] = "<div class='error' style='font-size: 16px'>Select Start date +1 day after End Date</div>";
header('location:'.SITEURL);
}
}
how can i display the form details and the date difference in another page after submission