0

Actually the form below is a registration form, and i only have ' username, email, password and confirm password field' so i want to add another field name job, but keeps getting error.
see the code below;

if (!preg_match("/^[a-zA-Z ]+$/",$name)) {
        $error = true;
        $name_error = "Name must contain only alphabets and space";
    }
    if(!filter_var($email,FILTER_VALIDATE_EMAIL)) {
        $error = true;
        $email_error = "Please Enter Valid Email ID";
    }
    if(strlen($password) < 6) {
        $error = true;
        $password_error = "Password must be minimum of 6 characters";
    }
    if($password != $cpassword) {
        $error = true;
        $cpassword_error = "Password and Confirm Password doesn't match";
    }

    if (!preg_match($job)) {
        $error = true;
        $job_error = "Job area must be specified";
    }
    if (!$error) {
        if(mysqli_query($con, "INSERT INTO users(name,email,password,job) VALUES('" . $name . "', '" . $email . "', '" . md5($password) . "',  '" . $job . "')")) {
            $successmsg = "Successfully Registered! <a href='login.php'>Click here to Login</a>";
        } else {
            $errormsg = "Error in registering...Please try again later!";
        }
    }
2
Contributors
1
Reply
14
Views
4 Months
Discussion Span
Last Post by diafol
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.