I am validating all the $_POST
fields dynamically. The issue is that visitors can change the name attribute to anything else using Inspect Element and submit the form and the validation will not happen. Like, if the client changes the name attribute from email
to a random word, validation will not happen for that field. How can i prevent this. I have to get all the all the post fields dynamically though
<input type = "text" name = "email[0]">
<input type = "text" name = "aphabets[1]">
<input type = "text" name = "numbers[1]">
foreach ($_POST as $key => $value) {
foreach($value as $k => $v){
if ($key[$i] === "email"){
email($v);
}
if ($key[$i] === "numbers"){
required($v);
}
}
}
function email($v){
//validate email
}
function required($v){
//validate email
}