Duplicate comments after refreshing

#1

I am new to learning PHP and SQL and am trying to implement a comment section on my website,
but if you comment, then refresh the page, the comment is duplicated, does anyone know why?
The live version is on http://alexsgamehub.com/test

code for sending/getting comments:
https://drive.google.com/file/d/1w8kVS-up8KUuMlY7yinHSvo6NAtnjnQ8/view?usp=sharing

code for test homepage:
https://drive.google.com/file/d/1PeyrjZk7uE58r93H0hDiGzi5PuYZFr6P/view?usp=sharing

#2

1, post code on the forum or in something that is more long term than you google drive.

Odds are that when you refresh the page, it is submitting the comment again; leading to duplicate posts.

#3

You need to implement PRG.

https://en.wikipedia.org/wiki/Post/Redirect/Get

1 Like