Ciao,
dato che i campi della tabella sono già definiti, potresti semplificare il codice con un array che funge da whitelist e la funzione in_array().
Es:
Codice PHP:$whitelist = ['name', 'surname', 'email', 'phone'];
if (isset($_POST['submit'])) {
$submit = $_POST['submit'];
if (!in_array($submit, $whitelist)) {
// Errore
} else {
// OK
}
}

Rispondi quotando