$name_ary isn't used anywhere in the following code, $mark_ary is used.

if (empty($mark_ary)) should be used instead of just comparing an array it to false.