Skip to content

Instantly share code, notes, and snippets.

@rintoug
Created May 22, 2017 09:34
Show Gist options
  • Select an option

  • Save rintoug/29c9f7542b7697207ad3b8ab40efb377 to your computer and use it in GitHub Desktop.

Select an option

Save rintoug/29c9f7542b7697207ad3b8ab40efb377 to your computer and use it in GitHub Desktop.
PHP User Registration Form
<?php
//Form validation
/* Form Required Field Validation */
foreach($_POST as $key=>$value) {
if(empty($_POST[$key])) {
$error[] = "All Fields are required";
break;
}
}
/* Email Validation */
if (!filter_var($_POST["email"], FILTER_VALIDATE_EMAIL)) {
$error[] = "Invalid Email Address";
}
/* Password Match Validation */
if($_POST['password'] != $_POST['confirm_password']){
$error[] = 'Passwords does not match';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment