[eluser]BrianDHall[/eluser]
You can also use the empty function, which works on arrays as you would expect it would (an empty array is, predictably, empty, but if it is not set at all it will still return in an expected fashion and not throw any errors):
Code:
if (empty($data['agent']))
{
foreach..
Be careful of isset(), because a variable containing an empty string, or null, or an array with no elements, or an array element that is set but contains nothing, will all returning true as being 'set'.