kingot
01-19-2012, 05:01 PM
Hi ,
I have this code ..and when a form is field correctly and submit, still the 'Please enter all fields are required' error message display.
How do i make it not display when the form is field correctly.
Here is the code
//learning of oop
class Users{
public $name;
public $email;
public $password;
public $confirm_pass;
//checking for name,email,password
public function CheckUserInput($name,$email,$password){
if(isset($_POST['name']) && isset($_POST['email']) && isset($_POST['password'])
&& isset($_POST['confirm_pass'])){
$this->name=$_POST['name'];
$this->email=$_POST['email'];
$this->password=$_POST['password'];
$this->confirm_pass=$_POST['confirm_pass'];
if(!empty($this->name) && !empty($this->email) && !empty($this->password)
&&!empty($confirm_pass)){
echo 'OK';
}else{
echo 'Please enter all fields are required'.'<br>';
}
}
}
//checking for confirm password
public function ConfirmPass($confirm_pass){
if(!($this->password==$this->confirm_pass)){
echo 'Password do not much';
}
}
}
$UserInput= new Users;
$UserInput->CheckUserInput('name','email','password');
$UserInput->ConfirmPass('confirm_pass');
<form action="index.php" method="POST">
Your Name:<br> <input type="text" name="name"> <br>
Your Email:<br> <input type="email" name="email"><br>
Your Passwword:<br> <input type="password" name="password"><br>
confirm Password:<br> <input type="password" name="confirm_pass"><br>
<input type="submit" value="Submit">
</form>
Thanks
I have this code ..and when a form is field correctly and submit, still the 'Please enter all fields are required' error message display.
How do i make it not display when the form is field correctly.
Here is the code
//learning of oop
class Users{
public $name;
public $email;
public $password;
public $confirm_pass;
//checking for name,email,password
public function CheckUserInput($name,$email,$password){
if(isset($_POST['name']) && isset($_POST['email']) && isset($_POST['password'])
&& isset($_POST['confirm_pass'])){
$this->name=$_POST['name'];
$this->email=$_POST['email'];
$this->password=$_POST['password'];
$this->confirm_pass=$_POST['confirm_pass'];
if(!empty($this->name) && !empty($this->email) && !empty($this->password)
&&!empty($confirm_pass)){
echo 'OK';
}else{
echo 'Please enter all fields are required'.'<br>';
}
}
}
//checking for confirm password
public function ConfirmPass($confirm_pass){
if(!($this->password==$this->confirm_pass)){
echo 'Password do not much';
}
}
}
$UserInput= new Users;
$UserInput->CheckUserInput('name','email','password');
$UserInput->ConfirmPass('confirm_pass');
<form action="index.php" method="POST">
Your Name:<br> <input type="text" name="name"> <br>
Your Email:<br> <input type="email" name="email"><br>
Your Passwword:<br> <input type="password" name="password"><br>
confirm Password:<br> <input type="password" name="confirm_pass"><br>
<input type="submit" value="Submit">
</form>
Thanks