Tuesday, May 24, 2016

A simple Validation Form in PHP

Today I am going to share a simple script in PHP which does the validation when user registers with your site.It is a very simple one and aimed at a complete newb.I am not going to discuss much about the script as it is pretty much self explanatory.The script is given below:

<?php 
}
else {
$usr = new Users;
$usr->storeFormValues( $_POST );
$n6 = 6;

if( $_POST[password] == $_POST[cpassword] ) {
echo $usr->register($_POST);
}
else {
echo "Password and Confirm password not match";
}

if( $_POST[username] < $n6 ) {
echo "Username must be more than 6 characters.";
}
else {
echo $usr->register($_POST);
}

if( $_POST[password] < $n6 ) {
echo "Password must be more than 6 characters.";
}
else {
echo $usr->register($_POST);
}
}
?>
Thats it with it.You may change it according to your needs.Besides, if your are working on a Registration form then you will also find the Login Form in PHP interesting.

Enjoy!