I'm trying to add data to my database but it won't work, and no error message is displayed.
order.php:
<?php
$con=mysqli_connect("localhost","root","","jutta");
//if form is submitted
if(isset($_POST['submit'])) {
$size=$_POST['shoe_sizes'];
$qan=$_POST['quantity'];
$details=$_POST['shipping_address'];
$contact=$_POST['contact'];
$date=date('Y-m-d');
$sql="INSERT INTO orders(size, qan, address, contact, date) VALUES ($size, '$qan', '$address', '$contact', '$date')";
$query=mysqli_query($con, $sql) or die('Query could not be connected.');
if($query) {
echo "success";
}
else {
echo "fail.";
}
}
?>
My form:
<form action='order.php' method='post'>
<br>
<a href='admin/product_images/$pro_image' title='$pro_title' class='MagicZoom'>
<img src='admin/product_images/$pro_image' width='200' height='150' class='img-responsive'/></a><br>
Name: <font style='color:#2E9AFE; text-align: center;'><b>$pro_title </b></font>
<p><label>Price:</label> <font style='color:black; text-align: center;'><b> Rs. $pro_price </b></font></p>
<div class='row'>
<div class='col-sm-6'>
<b><label>Select Size:</label> </b><select name='shoe_sizes'>
<option>5</option>
<option>6</option>
<option>7</option>
<option>8</option>
<option>9</option>
</select>
</div>
<div class='col-sm-6'>
<b><label>Quantity:</label> </b><select name='quantity'>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
</select></div>
</div><hr>
<b style='color: grey;'><label>Shipping Address: <br></b><textarea name='shipping_address' cols='25' rows='3' required /></textarea><br>
<b><label>Contact No. :</label></b> <input name='contact' type='tel' id='phone' placeholder='Your Contact Number'>
<hr>
<button type='submit' name='submit' class='btn btn-primary'><a href='order.php' style='color:white; text-decoration:none;'>Order Now</a></button>
</form>
It redirects me to order.php
file without inserting data to datbase and not even any message just a blank page.