Welcome Guest, Not a member yet? Register   Sign In
how to retrieve the values of mulple list?
#6

[eluser]jcopling[/eluser]
It's true that a foreach loop is more efficient. But I find that when I need multiple values from a form post, I need it for more than one corresponding fields. So it's just as easy to do something like this:

Code:
$community = $this->input->post('community');
$location = $this->input->post('location');
$membercount = $this->input->post('membercount');
for($i=0; $i<=count($community);$i++){
//do something with community[$i]
//do something with location[$i]
//do something with membercount[$i]
}

But you're absolutely correct. If you are only needing to loop through 1 set of values a foreach loop would be preferable.


Messages In This Thread
how to retrieve the values of mulple list? - by El Forum - 01-17-2008, 07:17 AM
how to retrieve the values of mulple list? - by El Forum - 01-17-2008, 07:30 AM
how to retrieve the values of mulple list? - by El Forum - 01-17-2008, 02:07 PM
how to retrieve the values of mulple list? - by El Forum - 01-17-2008, 04:40 PM
how to retrieve the values of mulple list? - by El Forum - 01-18-2008, 02:32 AM
how to retrieve the values of mulple list? - by El Forum - 01-18-2008, 09:11 AM
how to retrieve the values of mulple list? - by El Forum - 01-18-2008, 09:33 AM
how to retrieve the values of mulple list? - by El Forum - 01-18-2008, 09:41 AM



Theme © iAndrew 2016 - Forum software by © MyBB