[Solved] form_validation how to prevent space in username |
[eluser]Ahmed Iqbal[/eluser]
hello, i know codeigniter form validation...! please, let me know how i prevent blank space in username....! because some idiot users put space in their username....! Please suggest me....!
[eluser]John_Betong_002[/eluser]
Try this: 1. accept the user's input 2. store using url_title(); 3. retrieve and display using str_replace('-', ' ' , $username); If the user inputs a dash then this will remove the displayed dash. This requires further logic but at least it's a start
[eluser]Ahmed Iqbal[/eluser]
thanks but i want when user signup and enter username with space validation error appear. hey don't try to enter space in your username :}
[eluser]cideveloper[/eluser]
Use a callback Code: $this->form_validation->set_rules('username', 'Username', 'trim|required|valid_email|callback_username_check_blank|xss_clean');
[eluser]CroNiX[/eluser]
[quote author="Ahmed Iqbal" date="1307048083"] because some idiot users put space in their username....! [/quote] I just thought that was a funny comment coming from someone with a space in their username ;-P
[eluser]regal2157[/eluser]
lol CroNiX as well. that's just hilarious. I didn't see that one!
[eluser]John_Betong_002[/eluser]
[b]@CroNiX[b] - very funny, a good start for today |
Welcome Guest, Not a member yet? Register Sign In |