Welcome Guest, Not a member yet? Register   Sign In
Form_validation: How do I not allow spaces?

I want users to register a username with no spaces and only allow A-Z and 0-9, no other characters. How do I use the form_validation to make sure the user submits with the rule as stated above?

I just noticed in the form_validation there is:
function alpha_numeric($str)
        return ( ! preg_match("/^([a-z0-9])+$/i", $str)) ? FALSE : TRUE;
Which is perfect for me wanting to limit it to a-z and 0-9. I think I should be able to make a function that limits spaces. I'll post back if I'm successful.

Theme © iAndrew 2016 - Forum software by © MyBB