Welcome Guest, Not a member yet? Register   Sign In
How to pass an array as the 2nd parameter to set_rules()
#3

[eluser]cheungj[/eluser]
[quote author="jmadsen" date="1341179659"]cheungi,

Sorry, I'm quoting from memory, but I believe if you:

-- remove the [] from your price_name
-- remove the $this->input->post & the [] from your callback

You will then be able to access this array as


Code:
function price_validation($price_name){
     // $price_name is your array, so iterate over it and do your validation, returning TRUE if it makes it all the way through the array
}
[/quote]

Thanks for the reply.
Sorry, but I'm not exactly sure how to implement your solution.
I know how to pass an array to a function. My problem is that I can't pass an array in as the second parameter to the function.
The function looks like this:
Code:
function price_validation($price_name, $price_value) {
}

I'm also after noticing that the validation rule is run for each element of the array. I have <i>n</i> input fields, meaning that I can have <i>n</i> validations running.


Messages In This Thread
How to pass an array as the 2nd parameter to set_rules() - by El Forum - 07-02-2012, 03:04 AM



Theme © iAndrew 2016 - Forum software by © MyBB