I am new to PHP and I am trying to enter details into my database.
Session I want to insert data into database with
<form method="post" action="">
  <input name="p_date" type="date">
  <input name="r_date" type="date">
</form>
 if (!empty($_POST)) {
     $_SESSION['p_date'] = $_POST['p_date'];
     $_SESSION['r_date'] = $_POST['r_date'];
}
This code, Url on the side True is spinning but can't add data to database. Where could i be wrong?
if(isset($_POST['dateSearch'])) {
    $insert=$connect->prepare("Insert Into test (p_date,r_date) VALUES ('{$_SESSION['p_date']}','{$_SESSION['r_date']}'");
    if($insert) {
        header("Location:cars.php?Status=True");
    }
    else {
        header("Location:cars.php?Status=False");
    }
}
Thanks in advance..
 
    