I have a php registration Script with a php form validation. The Validation seems to be working fine But it is independent of mysql insert query so whether the form input is correct or not the data will still be sink into the data base.[php]
Register Page<?php if (isset($_POST["submit"])&&(empty($fname))) { echo"
<?php if (isset($_POST["submit"])&&(empty($lname))) { echo"
<?php if (isset($_POST["submit"])&&(empty($username))) { echo"
<?php if (isset($_POST["submit"])&&(empty($email))) { echo"
<?php if (isset($_POST["submit"])&&(empty($password))) { echo"
<?php if (isset($_POST["submit"])&&(empty($phone))) { echo"
<?php if (isset($_POST["submit"])&&(empty($gender))) { echo"
that is my register.php that contain the php form validation.
Here is check_register that contains the mysql query
Someone Please Use master eye and Spot the Problem for me
[php]<?php
$host=“localhost”;
$dbuser=“root”;
$dbpass="";
$db_name=“login”;
$db_table=“login”;
mysql_connect("$host","$dbuser","$dbpass")
or die(“Could Not Establish Connection”);
mysql_select_db("$db_name")or die(mysql_error());
$fname=$_POST[“fname”];
$lname=$_POST[“lname”];
$username=$_POST[“username”];
$email=$_POST[“email”];
$password=$_POST[“password”];
$phone=$_POST[“phone”];
$gender=$_POST[“gender”];
//validation of input in the form fieldS
include(“register.php”);
$submit=mysql_query(“INSERT INTO users(fname,lname,username,email,password,phone,gender)VALUES(’$fname’,’$lname’,’$username’,’$email’,’$password’,’$phone’,’$gender’)”) or die(“REGISTRATION NOT COMPLETED Thanks”);
if($submit==TRUE){
Echo"
}
?>[/php]