I need to count how many variables value is set to "yes". I have test=yes, stuff=no, bla=yes. I need to count how many of "yes" are set. How can I do that?
set a counter write a for/foreach loop, test value using if and increase the counter. and there you get the number of 'yes' in your $_GET array simple $counter = 0; foreach($_GET as $key=>$value) { $counter = ($value=='Yes')? $counter++:$counter; } echo $counter; PHP:
try this foreach($_GET as $key=>$value){ if($value==yes){$count++;} } echo $count; edit: damn..too late
Thanks folks, yeah, bother were late, I already figured it out, but hey, maybe there are others who will also need this. Thanks again.