I have created a html form and and a database to store the inputs from user. Here is the html form code
<form class="form" method="post" action="data.php">
<div class="form-group">
<input class="form-control input-lg" type="text" placeholder="Full Name" name="name" id="name" required="">
</div>
<div class="form-group">
<input class="form-control input-lg" type="tel" placeholder="Phone Number" name="phone" id="phone" required="">
</div>
<div class="form-group">
<input class="form-control input-lg" type="email" placeholder="Email ID" name="email" id="email" required="">
</div>
<div class="form-group">
<input class="form-control input-lg option" type="date" name="date" value="Date" id="date" required="">
</div>
<div class="form-group">
<select class="form-control input-lg option" name="time" id="time" style="padding-left: 10px;">
<option>Time Slot</option>
<option>10:00-11:00</option>
<option>11:00-12:00</option>
<option>12:00-13:00</option>
<option>13:00-14:00</option>
<option>14:00-15:00</option>
<option>15:00-16:00</option>
<option>16:00-17:00</option>
</select>
</div>
<input class="btn btn-success btn-lg" style="margin-left: 30%; margin-top:10px; padding: 5px 16px;" type="submit" value="BOOK">
</form>
and data.php file is
<?php
$servername = "localhost";
$username = "root";
$password = "user";
// Create connection
$conn = new mysqli($servername, $username, $password);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "INSERT INTO data (name, phone, email, date, time)
VALUES ('$_POST[name]', '$_POST[phone]', '$_POST[email]', '$_POST[date]', '$_POST[time]')";
echo "Connected successfully";
?>
So when i input some values in html form it shows connected successfully but in database no inputs are showing in data table.
So please help me to solve this issue.
</div>