I have created a database in MySQL WAMP server and is not saving results. Please tell me what should I do. There is no error while submitting in localhost.
Can't add more details:
<?php
if (isset($_POST['Submit'])) {
$firstName = $_POST['Name'];
$fatherName = $_POST['fatherName'];
$email = $_POST['Email'];
$NIC = $_POST['NIC'];
$server = '127.0.0.1';
$vid = 'root';
$pwd = '';
$conn = mysqli_connect($server, $vid, $pwd);
if (!$conn) {
echo "server not found";
} else {
echo"stored successfully";
@mysql_select_db("database1");
//$firstName= "nazi";
//$fatherName="Ali";
//$email= "nazia.se@yahoo.com";
//$NIC= 67567678;
//$sqlquery="INSERT INTO tab1 (name,fname,email,nic) VALUES ('$firstName', '$fatherName', '$email', $NIC)";
$sqlquery = "INSERT INTO form(name,fname,email,nic) VALUES ('$firstName', '$fatherName', '$email', $NIC)";
//echo $sqlquery;
mysql_query($sqlquery);
}
}
if (isset($_POST['Submit'])) {
if(empty($firstName)){
echo nl2br("Please write name.\n");
return false;
}
if (empty($fatherName)) {
echo nl2br("Please write email .\n");
}
if (empty($email)) {
echo nl2br("Please write email .\n");
}
if (empty($NIC)) {
echo nl2br("Please write NIC number .\n");
};
}
?>
<form id="form1" name="form1" method="post" >
<p> </p>
<p align="center" class="style1"> REGISTERATION FORM </p>
<p> </p>
<table width="447" border="1">
<tr>
<td width="169">Name</td>
<td width="262"><label>
<input name="Name" type="text" />
</label></td>
</tr>
<tr>
<td>Father Name</td>
<td><label>
<input type="text" name="fatherName" />
</label></td>
</tr>
<tr>
<td>email Address</td>
<td><label>
<input name="Email" type="text" />
</label></td>
</tr>
<tr>
<td>NIC </td>
<td><label>
<input name="NIC" type="text" size="15" />
</label></td>
</tr>
<tr>
<td colspan="2"><input type="submit" name="Submit" value="Submit" /> </td>
</tr>
</table>
</form>