Block forced editing of Hidden input

Asked

Viewed 127 times

0

For example, I have a stock system in PHP and in it the section edit quantity of the product. Here we have a form to add quantity. In this form I have an Hidden field that takes the product id to update the products table.

I take this post and send via ajax to a php management file to do the validation.

Doubt, if I go there in the "inspect element" of the browser, change in hand the value field of the Hidden input php/code will accept the forced insertion of a field that for being Hidden should only take the value to the post and not be edited.

Is there any way to prevent this?

  • 1

    Yes, working in the back end so that the Hidden input is not part of the data change logic

  • 1

    Work with sessions. Store the cart data in an array and when you receive this request, you check if the product is in the cart.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.