Page 1 of 1

registration form validation error..

Posted: Tue Jan 24, 2012 4:32 pm
by danielbala
include("config.php");
if(isset($_POST['submit'],$_POST['fullname'],$_POST['username'], $_POST['password'], $_POST['email'], $_POST['emp_role']))
{
$submit=$_POST['submit'];
$date=date("y-m-d");
$fullname = mysql_real_escape_string($_POST['fullname']);
$username = mysql_real_escape_string($_POST['username']);
$password = md5(mysql_real_escape_string($_POST['password']));
$email = mysql_real_escape_string($_POST['email']);
$emp_role = (int)$_POST['emp_role'];

if($submit)
{
if($fullname&&$username&&$password&&$email&&$emp_role)
{


$sql="INSERT INTO `logindetails` (fullname,username, password, email, emp_role,$date) VALUES ('$fullname',$username', '$password','$email','$emp_role','$date')";
$result=mysql_query($sql) or die(mysql_error());


echo "<h1>you have registered sucessfully</h1>";

echo "<a href='login.php'>go to login page</a>";

}
else
{
echo "Please fill in <b>all</b>fields!";
}
}
}
?>

any error in this code?????
if i submit the form im not getting any msg....

Re: registration form validation error..

Posted: Tue Jan 24, 2012 5:32 pm
by danielbala
anyone to help me..its very urgent

Re: registration form validation error..

Posted: Wed Jan 25, 2012 3:45 pm
by social_experiment

Code: Select all

<?php
if($submit)
{
  if($fullname&&$username&&$password&&$email&&$emp_role)
  {


  $sql="INSERT INTO `logindetails` (fullname,username, password, email, emp_role,$date) VALUES ('$fullname',$username',     '$password','$email','$emp_role','$date')";
$result=mysql_query($sql) or die(mysql_error());


echo "<h1>you have registered sucessfully</h1>";

echo "<a href='login.php'>go to login page</a>";

}
else
{
echo "Please fill in <b>all</b>fields!";
}
}
// add this
else {
 echo 'Nothing';
}
?>
There is a else statetment missing which is where your script seems to be ending. If this is the case it means $submit is not true