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

[eluser]dallen33[/eluser]
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?
#2

[eluser]dallen33[/eluser]
I just noticed in the form_validation there is:
Code:
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