First of all, you should determine the size of the array before goes into the for loop statement.
$size = sizeof($_POST['people']);
for($i = 0; $i < $size; $i++) {....}
The reason for this is because if you have sizeof($_POST['people']) in the for loop statement, the for loop will find the size of the array every time when $i is compared with it. This will slow down the speed of the for loop. Try it with a huge array and you should be able to see the difference in speed.
There are many ways to solve your problem and here is one of them. Find out the number of the people in the list BEFORE and use the hidden field to pass it on when form is submitted.
<input type="hidden" name="num_of_people" value="5">
Then in the same form, list all of people with a checkbox next to their names with the same name with a different number but in the sequence.
<input type="checkbox" name="people_1" value="John"> John<br>
<input type="checkbox" name="people_2" value="Nick"> Nick<br>
<input type="checkbox" name="people_3" value="Cindy"> Cindy<br>
<input type="checkbox" name="people_4" value="Kelly"> Kelly<br>
<input type="checkbox" name="people_5" value="Will"> Will<br>
You can find out how many people you wanna display (from the database or whatever) easily.
Then after the form is submitted, do
for($i = 1; $i <= $POST['num_of_people']; )
{
$name = "people". $i;
if(!empty($POST[$name])) { echo $POST[$name]; }
$i++;
if($i < $_POST['num_of_people']) { echo (", ");
}
echo ("performed: ". $operation ." on ". $today ." which took ". $hours1 ." man hours");
This should do your job.
Of course, there are many other ways to do it and there may be much better way of doing it too, but this is just an example and you don't need to use it if you or others come up with a better solution.
Good luck man