My simple php form validation script:
$email = (isset($_POST['email'])) ? $_POST['email'] : '' ;
$password = (isset($_POST['password'])) ? $_POST['password'] : '' ;
$fname = (isset($_POST['fname'])) ? $_POST['fname'] : '' ;
$lname = (isset($_POST['lname'])) ? $_POST['lname'] : '' ;
if (!empty($email) && !empty($password) && !empty($fname) && !empty($lname)) {
$auth->createAccount($email, $password, $fname, $lname);
}
For some reason it doesn't look very good to me.
How can I check each form field to indicate which one is the one that needs filling out and then at the end check to make sure all fields are filled out before calling the createAccount() function.
Note: the createAccount() function sanitizes the input so there is no need to do this here.
<noscript>? if js is disabled/doesn't support js put something in there to notify user that js is turned off?requiredin input and validate with jQuery, make users life easy when they filling the form