Here is my form code ,
<form role="form" id="order-form" action="db.php" method="post">
<div class="form-group">
<label for="name">Name</label>
<input type="text" class="form-control" id="name" name="name" placeholder="Your Full Name">
</div>
<div class="form-group">
<label for="address">Delivery Address</label>
<textarea class="form-control" rows="3" id="address" name="address" placeholder="Address" ></textarea>
</div>
<div class="form-group">
<label for="phone">Phone No</label>
<input type="text" class="form-control" id="phone" name="mobile" placeholder="Phone No">
</div>
<div class="form-group">
<label for="email">Email address</label>
<input type="email" class="form-control" id="email" name="email" placeholder="Enter email">
</div>
<div class="form-group">
<label for="exampleInputEmail1">Quantity</label>
<select class="form-control" id="quantity" name="quantity">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
</div>
<div class="form-group" >
<label for="exampleInputEmail1">Expected Date</label>
<input id="datepicker" name="date" >
</div>
<button type="submit" class="btn btn-default" >Submit</button>
</form>
THis is my db.php .
<?php
$con=mysqli_connect("localhost","root","","honey");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$sql="INSERT INTO pre_order
(name,delivery_location,mobile,email,qty,workdt)
VALUES
('$_POST[name]','$_POST[address]','$_POST[mobile]','$_POST[email]','$_POST[quantity]','$_POST[date]')";
if (!mysqli_query($con,$sql))
{
die('Error: ' . mysqli_error($con));
}
//'echo "Order Received";
mysqli_close($con);
?>
when I click on submit form , It says
PHP Notices:
Notice: Undefined index: address in C:\xampp\htdocs\office_work\ironbull2\ironbull\db.php on line 12
Notice: Undefined index: date in C:\xampp\htdocs\office_work\ironbull2\ironbull\db.php on line 12
The date picker I have used here is a jquery ui plugin
.