I am trying to make a registration form and when submit it will save in my phpmyadmin database.
this is for my register.html :
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Register</title>
</head>
<body>
<form name="register" action="register_p.php" method="post">
<center><table width="900" border="0" cellspacing="0" cellpadding="0">
<center></br></br>
<tr><td width="61%"><p>Full Name:
<input name="Fullname" type="text" id="Fullname" size="40" /> </p>
</td>
</tr>
<tr>
<td width="61%"><p>Username:
<input name="Username" type="text" id="Username" size="30" /> <b>* Word must not have any sign (*.,&_/) and must be between 3 or 15 characters</b></p>
</td>
</tr>
<tr>
<td><p>Password:
<input name="Password" type="password" id="Password" value="" size="30" /> <b>* Your password must be between 6 and 12 digits and characters</b></p>
</td>
</tr>
<tr>
<td width="61%"><p>Email:
<input name="Email" type="text" id="Email" size="30" /> <b>*Your email address (e.g: halimah@yahoo.com)</br></p>
</td>
</tr>
<tr>
<td width="61%"><p>Phone:
<input name="Phone" type="text" id="Phone" size="30" /> <b>* Phone number must not be longer than 11 number (e.g:012-34333434)</b></p>
</td>
</tr>
<tr>
<td width="61%"><p>Address:
<textarea name="Address" type="text" id="Address" cols="40" rows="5"></textarea></p>
</td>
</tr>
<tr>
<td width="61%"><p>Zip Code:
<input name="Zip_code" type="text" id="Zip_code" size="30" /> </p>
</td>
</tr>
<tr>
<td width="61%"><p>Country:
<input name="Country" type="text" id="Country" size="30" /> <b></br></p>
</td>
</tr>
<tr>
<td width="61%"><input type="checkbox" name="Terms" id="Terms" /><font color="red">Check if you have read our <a href="terms.php">terms and condition</a></font><br /></td>
</tr>
<tr>
<td>
<input name="register" type="submit" id="register" value="Register"/>
</td>
</tr>
</table>
</center>
</body>
</html>
and for register_p.php :
<?php
//open connection
$con=mysqli_connect("my.com", "my", "000000000p","my_db");
// Check connection
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
//---//
// escape variables for security
$Fullname = mysqli_real_escape_string($con, $_POST['Fullname']);
$Username = mysqli_real_escape_string($con, $_POST['Username']);
$Password = mysqli_real_escape_string($con, $_POST['Password']);
$Email = mysqli_real_escape_string($con, $_POST['Email']);
$Phone = mysqli_real_escape_string($con, $_POST['Phone']);
$Address = mysqli_real_escape_string($con, $_POST['Address']);
$Zip_code = mysqli_real_escape_string($con, $_POST['Zip_code']);
$Country = mysqli_real_escape_string($con, $_POST['Country']);
$Terms = mysqli_real_escape_string($con, $_POST['Terms']);
$sql="INSERT INTO register (Fullname, Username, Password, Email, Phone, Address, Zip_code, Country, Terms)
VALUES ('$Fullname', '$Username', '$Password', '$Email', '$Phone', '$Address', '$Zip_code', '$Country', '$Terms')";
if (!mysqli_query($con,$sql)) {
die('Error: ' . mysqli_error($con));
}
echo "1 record added";
}
else
{
echo "Please fill in the form to register.Not Succesful<br>";
}
mysqli_close($con);
?>
please help, the result that i get is A BLANK PAGE nd Nothing is insert into my database..