Welcome Guest, Not a member yet? Register   Sign In
Form Validation - Array Count
#1

[eluser]Unknown[/eluser]
Hi, I'm fairly new to CodeIgniter and I'm having an issue with the form validation library. What I'm trying to accomplish is, There are 10 types of Electronic Gadgets and a user is allowed to select minimum of 1 and a maximum of 4. These are checkboxes. In native PHP I could simply do this by

Code:
$selected_items_count = $_POST['gadget'];
if ( count( $selected_items_count) >= 1 && count( $selected_items_count) <= 4 ) {
....
}

But then again, I'm using CodeIgniter Smile I want to use the form validation library to accomplish this. I tried creating a callback function but each element in the $_POST["gadget"] is getting passed to it separately and not as the array itself. Can someone kindly help me out !

Thanks a lot in advance.


Messages In This Thread
Form Validation - Array Count - by El Forum - 05-24-2013, 06:43 AM
Form Validation - Array Count - by El Forum - 05-24-2013, 07:27 AM
Form Validation - Array Count - by El Forum - 05-24-2013, 10:49 AM



Theme © iAndrew 2016 - Forum software by © MyBB