1

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="">
0

1 Answer 1

1

You are closing the attribute with the single quote after post.

$post .= " <input type='text' name='post['" . $user . "'][comment]'">";
                                         ^             ^

Try:

$post .= " <input type='text' name='post[" . $user . "][comment]'">";

You also should view the source of your page, not the developer console when viewing the source. The developer console will correct some HTML syntax errors, but you need to see those to know how the PHP should be adjusted.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.