Do you know what is the error here:
$post .= " <input type='text' name='post['" . $user . "'][comment]'">";
Because with that code the html appears like:
<input type="text" name="post[" '][comment]'="" class="form-control" required="">
But it should appear:
<input type="text" name="post[1][comment]" class="form-control" required="">