I have following codes and it runes successfully and says that data successfully entered but when i check the database table, every time i insert data (Despite of that successful operation) i get one blank row. Inshort no data is being inserted although the code says operation successful
CODE: dbconnect.php
<?php
$host= "host";
$user = "user";
$password = "pass";
$db = "db";
$con = mysqli_connect($host,$user,$password,$db);
if (!$con)
{ echo "Failed to Connect"; }
else
{ echo "Connection successful";}
?>
CODE:addInfo.php
<?php
require "dbconnect.php";
$username = $_POST["username"];
$email = $_POST["email"];
$mobile = $_POST["mobile"];
$flag = false;
$sql = "insert into userInfo values('$username','$email','$mobile');";
$flag=mysqli_query($con,$sql);
if($flag!==false)
{
echo "Data inserted successfully!";
}
else
{
echo "Error in insertion" . mysqli_error($con);
}
?>
CODE:index.php
<!DOCTYPE html>
<html>
<head>
<title>Add Information</title>
</head>
<body>
<form action="addinfo.php">
<table>
<tr>
<td>Name:</td>
<td><input type="text" name="name"/></td>
<td>Email:</td>
<td><input type="text" name="email"/></td>
<td>Mobile:</td>
<td><input type="text" name="mobile"/></td>
</tr>
</table>
<input type ="submit" value="Submit" />
</form>
</body>
</html>
Any type of help you guys can do,please proceed,