I am using wamp server.I am trying to store the data which user fill in my form.But i don't know why its not getting added. These are my php files:(all files wrote in notepad++)
init.php:
<?php
$host = "localhost";
$db_user = "harsh";
$db_password = "password";
$db_name = "user_db";
$con = mysqli_connect($host,$db_user,$db_password,$db_name);
?>
register1.php:
<?php
require "init.php";
$name = $_POST["name"];
$adharnumber = $_POST["adharnumber"];
$email = $_POST["email"];
$password = $_POST["password"];
$contact = $_POST["contact"];
$sql="select * from individualuser_info where email like '".$email."';";
$result = mysqli_query($con,$sql);
$response = array();
if(mysqli_num_rows($result)>0)
{
$code = "reg_failed";
$message = "User already exist....";
array_push($response,array("code"=>$code,"message"=>$message));
echo json_encode($response);
}
else
{
$sql = "insert into individualuser_info (`".$name."','".$adharnumber."','".$email."','".$password."','".$contact."');";
$result = mysqli_query($con,$sql);
$code = "reg_success";
$message = "thank you .now you can login....";
array_push($response,array("code"=>$code,"message"=>$message));
echo json_encode($response);
}
mysqli_close($con);
?>
My form register_test.html:
<html>
<body>
<form action ="register1.php", method="post">
<table>
<tr>
<td>Name : </td><td><input type="text" name="name"/></td>
</tr>
<tr>
<td>Adhar number : </td><td><input type="text" name="adharnumber"/></td>
</tr>
<tr>
<td>Email:</td><td><input type="text" name="email"/></td>
</tr>
<tr>
<td>Password:</td><td><input type="password" name="password"/></td>
</tr>
<tr>
<td>Contact:</td><td><input type="text" name="contact"/></td>
</tr>
<tr>
<td><input type = "submit" value="Register"/></td>
</tr>
</table>
</form>
</body>
</html>
After making this files after starting wampserver when i am typing localhost/register_test.html in chrome url. It displays the form but unexpectedly in the email field it shows loacalhost automatically and in password field displays some password. And after filling the details when i click on register it shows message [{"code":"reg_success","message":"thank you .now you can login...."}]. But in database user_db in my individiualuser_info table no records gets added. Please help me to solve this.