I’m creating a website, and want to send data to MySQL, but it doesn't send.
I can give more details if needed.
Full code https://pastebin.com/JW5UUQbt
if(isset($_POST['submit2']))
{
$pid=intval($_GET['pkgid']);
$useremail=$_SESSION['login'];
$date=$_POST['date'];
$time=$_POST['time'];
$comment=$_POST['comment'];
$status=0;
$sql="INSERT INTO tblbooking (PackageId, UserEmail, BDate, BTime, Comment, status) VALUES (:pid, :useremail , :bdate , :btime , :comment , :status);";
$query = $dbh->prepare($sql);
$query->bindParam(':pid',$pid,PDO::PARAM_STR);
$query->bindParam(':useremail',$useremail,PDO::PARAM_STR);
$query->bindParam(':bdate',$date,PDO::PARAM_STR);
$query->bindParam(':btime',$time,PDO::PARAM_STR);
$query->bindParam(':comment',$comment,PDO::PARAM_STR);
$query->bindParam(':status',$status,PDO::PARAM_STR);
$query->execute();
?>
<form name="book" method="post">
<label class="inputLabel">Date</label>
<input type="text" name="date" required="">
<div class="bnr-right">
<label class="inputLabel">Time</label>
<input type="text" name="time" required="">
</div>
<label class="inputLabel">Comment</label>
<input class="special" type="text" name="comment">
</li>
<?php if($_SESSION['login'])
{?>
<li class="spe" align="center">
<button type="submit" name="submit2" class="btn-primary btn">Book</button>
</li>
<?php } else {?>
<li class="sigi" align="center" style="margin-top: 1%">
<a href="#" data-toggle="modal" data-target="#myModal4" class="btn-primary btn" > Book</a></li>
<?php } ?>
</div>
</div>
</form>
<?php }} ?>