I am working on a bootstrap form using phpmyadmin database. I can't get any data into my table when I fill out the form using insert statement. I don't any error and it doesn't tell me that I am not connected to the database. How can I insert my data into the database when I use the form ?
this is my php code
<?php
$con=mysqli_connect("localhost","username","password","database");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$sql="INSERT INTO entries (Name, Email, Age, Message)
VALUES
('$_POST[name]','$_POST[email]','$_POST[age]','$_POST[message]')";
if (!mysqli_query($con,$sql))
{
die('Error: ' . mysqli_error($con));
}
echo "1 record added";
mysqli_close($con);
?>
form code
<div style="margin-top:50px">
<div class="container">
<div class="panel panel-default" style="margin:0 auto;width:500px">
<div class="panel-heading">
<h1>Enter to win!</h1>
</div>
<div class="panel-body">
<form name="entryform" method="post" action="" class="form-horizontal" role="form">
<div class="form-group">
<label for="inputName" class="col-lg-2 control-label">Name</label>
<div class="col-lg-10">
<input type="text" class="form-control" id="Name" name="Name" placeholder="Your Name">
</div>
</div>
<div class="form-group">
<label for="inputEmail" class="col-lg-2 control-label">Email</label>
<div class="col-lg-10">
<input type="email" class="form-control" id="Email" name="Email" placeholder="Your Email">
</div>
</div>
<div class="form-group">
<label for="inputAge" class="col-lg-2 control-label">Age</label>
<div class="col-lg-10">
<input type="text" class="form-control" id="Age" name="Age" placeholder="What is your current age?">
</div>
</div>
<div class="form-group">
<label for="inputMessage" class="col-lg-2 control-label">Message</label>
<div class="col-lg-10">
<textarea class="form-control" rows="4" id="Message" name="Message" placeholder="What will you do with the prize?"></textarea>
</div>
</div>
<div class="form-group">
<div class="col-lg-offset-2 col-lg-10">
<button type="submit" class="btn btn-default">
Enter to win!
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
when I enter data from the form I get blank except id and timestamp