ctype_alnum($this->input->get('code', true)) not work? |
[eluser]helloworld7[/eluser]
Hi. I'm doing a check to see if the get input is alpha numeric but I get this error. Anyone know how I can resolve this or there's a way to validate? Fatal error: Can't use function return value in write context Thanks.
[eluser]LuckyFella73[/eluser]
Use CI Form Validation Class and set the matching rule like: Code: $this->form_validation->set_rules('input_field_name', 'Your Input Field Title', 'alpha_numeric'); Don't forget we have the very helpfull User Guide! http://ellislab.com/codeigniter/user-gui...ereference
[eluser]helloworld7[/eluser]
Sorry I didn't put enough info. That is actually from the query string. And it seems the form validation only for form inputs. I tried this with the input->get but it saying undefined index. Is there a validation class for input->get? If not how can I do alpha_numeric check for input->get data? Thank you.
[eluser]theprodigy[/eluser]
What happens if you use Code: $code = $this->input->get(‘code’, true); Code: ctype_alnum($this->input->get(‘code’, true));
[eluser]LuckyFella73[/eluser]
Quote:I tried this with the input->get but it saying undefined index. Did you enable query strings? I guess all get data is filtered otherwise. By default the GET array is destroyed before a controller is called.
[eluser]helloworld7[/eluser]
Hi. It seems it works using this. preg_match("/^[A-Za-z0-9]+$/", $code) I guess this is more a problem in php side instead. Thank you for your help. ![]() |
Welcome Guest, Not a member yet? Register Sign In |