How to protect hidden input to be changed by the user

26 Views Asked by At

I'm developing an online store website which has several products and user can submit comment for each single product. So when the user opens a product webpage, they can submit their comments via comment form. In order to do that I've put a hidden input in the comment form which holds the id of the product however, it can be easily manipulated. I've search a lot and I know that you can never trust data sent by the clients but I suppose there must be a way to make sure that the comment sent is exactly for the product the user is seeing right now. Because user can see a product on the website and change the product id in the hidden input of the comment form and submit it to the server. Please help. Thanks in advance.

0

There are 0 best solutions below