-3
Hello, I have a Select in a form with values only integers.
When receiving this information in PHP, I make the following validations:
Because I’m already wearing (int)
on line 297 and line 302, my first validation (on line 292, with !is_numeric
) is redundant?
On line 292 I check if it is a number, on line 297 if it is not "0" (which would indicate that it is the first option of select "Select...", ie the user sent the form without selecting any option) and on line 302 I check if the selected option really exists in DB (and which was not manually changed by "Inspect Element") and which is not "99", which is equivalent to the select "Other" option.
I mean, how am I using (int), do I really need the 292 line? Or do I need to do this double-check?
Thank you.
Related: What is the difference between Sanitize and filter in php?
– rray