Validation with variables |
(04-04-2015, 04:31 PM)ruiganga Wrote: This way doesn't work. Data is neve valid. Always that is NOT valid. Yes, you are. The form validation do not take variables like that. The first value, where you have $email, is the name of the POST data in global $_POST array. As in my example, lets say that in the AJAX request you do, you send a parameter called 'user_email'. In the controller you send the request to, that 'user_email' data will be available in the global $_POST array as $_POST['user_email'] So, in $this->form_validation->set_rules(); you set the first option to 'user_email' as that is the name of the your data in the global $_POST array. If you for some reason don't have the data available in the global $_POST array anymore, then you can validate any other type of array. So, in your case, you could create a new array with your email and then set that as the array that form validation should validate. Here is an example. PHP Code: $validate_data = array('email' => $email); More info about validation an array here http://www.codeigniter.com/userguide3/li...-than-post |
Messages In This Thread |
Validation with variables - by ruiganga - 04-04-2015, 10:11 AM
RE: Validation with variables - by vrsotto - 04-04-2015, 10:16 AM
RE: Validation with variables - by ruiganga - 04-04-2015, 10:22 AM
RE: Validation with variables - by vrsotto - 04-04-2015, 10:33 AM
RE: Validation with variables - by silentium - 04-04-2015, 11:02 AM
RE: Validation with variables - by ruiganga - 04-04-2015, 04:30 PM
RE: Validation with variables - by ruiganga - 04-04-2015, 04:31 PM
RE: Validation with variables - by silentium - 04-06-2015, 10:51 AM
RE: Validation with variables - by ruiganga - 04-06-2015, 01:02 PM
RE: Validation with variables - by ruiganga - 04-04-2015, 04:45 PM
RE: Validation with variables - by ruiganga - 04-04-2015, 04:53 PM
RE: Validation with variables - by madaan_tushar - 05-26-2015, 02:40 AM
|