php - Form validation - security -
so i'm working on register form , have 4 fields: name, username, email , password. pick values of these fields in jquery , depending on if fields filled, pass them onto php script via ajax. safe form validations? worried data getting manipulated user. further on in php script, check if posted values have data in them, proceed onto doing validations... validations parts i'm worried it's not best , there many flaws it. $name = $_post['name']; $username = $_post['username']; $email = $_post['email']; $password = $_post['password']; if (!preg_match("/^[a-za-z '-]+$/i", $name)) { $errors = "please enter valid name."; } else if (!preg_match("/^[a-za-z]+\s[a-za-z]+$/", $name)) { $errors = "please enter first , last name."; } else if (strlen($username) <= 3 || strlen($username) > 15) { $errors = "please pick username between 4 - 15 ch...