This is probably a silly question but I just don't know the right sollution. I am selecting items from my database in a loop. These items are displayed on my website as submit form. In the forms I have hidden input fields that contain the ID of a specific item. The only problem is that anyone can change this idea in the developer tools/inspector. What is a more reliable way to do this?
What I eventually want to do is storing this value in my database.
So I have this query:
$insert_query = mysqli_query($con," INSERT INTO `building` SET `player_id` = '".$_SESSION['user']['id']."', `building_id` = '".$_POST['building_id']."' ");
And using this hidden input field:
<input type="hidden" value="<?php echo $row['building_id']; ?>" name="building_id">
How can I approach this safely without the user being able to change the id?