How do I impliment a hidden field in a post form so users can't accidentally double post? (PHP/Mysql
- by ggfan
When users submit a form, they will sometimes click refresh or backspace then resubmit which causes multiple entries in mysql. How can i prevent mysql from allowing more than 1 of the same entry? People suggested a hidden field with a value, but how do I use that?
<label for="state" class="styled">State:</label>
<input type="text" id="state" name="state" value="<?php if (!empty($state)) echo $state;
?>" size="30" /><br />
//a hidden field of a certain value?
________________________________________
<input type="submit" value="Post Ad!" name="submit" />
//php to insert to mysql
$query4 = "INSERT INTO posting (state) VALUES ('$state')";
mysqli_query($dbc, $query4);