Task: to provide a selection from the list of one or more data filter criteria. I accept the selected filter options in an array, everything is OK, with a for loop I set the following condition: Variables: count counting the number of array elements, radiop filter list obtained.

 for ($i=0; $i<=$count; $i++) echo "$radiop[$i]<br>"; print_r ($i); 

It is not possible to display correctly $radiop[$i] warning "Notice: Undefined offset" . Counting displays 6 selected filter points, print_r ($i) gives 7, although there are 6 of them. Question: how to display the selected elements of the array correctly?

    1 answer 1

    It's all about $i<=$count , when $count is 6, the loop will run 7 times, and the array has only 6 elements, you need to replace the condition with $i<$count

    • Thank. Elementary :) - Eugene