The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Try out my first PHP web app! Reply To: Try out my first PHP web app!


To clarify, there are really two problems here.

  1. In your PHP, you are outputting elements in a loop, all with the same id: commentbox, username, and so forth. However, HTML expects ids to be unique. commentbox should be a class name, username should be a data attribute. Remove the ids.

  2. In your JS, you’re using inline event handlers, which are very old (DOM0) and generally shouldn’t be used anymore. See my post above.