if i have this simple form selector below:
<form id="myform" class="form" role="form" accept-charset="utf-8" method="post" action="/mypage.php">
<select id="gender" name="gender">
<option selected="" value=""></option>
<option value="man">man</option>
<option value="women">women</option>
</select>
<button type="submit" name="insert"> Send </button>
</form>
and this little php code to retrieve data:
if (isset($_POST['insert'])) {
if(!isset($_POST['gender']) || strlen($_POST['gender'])<3)
{
header('location:'.$_SERVER['PHP_SELF'].'?error');
exit;
}
$gender = ($_POST['gender']);
...
// INSERT INTO DATABASE
}
and now someone with Firebug modify the option value from "man" to "vulnerability" and click submit this new value will be insert into my database and not the previous one.
My question is: how can i prevent this with php language ?
thanks.