I have been coding a script, and I am stuck at one small part. I am checking to make sure that the form the user submits is secured. But I'm not sure how to approach the dropdown box, this is the code I have so far:
if ($_POST['type'] != '1' || $_POST['type'] != '2' || $_POST['type'] != '3') // Checks to see if the submitted type matches, prevents exploiting.
{
$supportErrors[] = "Support type you've chosen was not found, possibly trying to exploit this script?";
}
I am not sure if this is the right way to check its value. This is my HTML side for this part of the script:
<select name="type" id="type" size="1" style="border: 1px solid #000000; background-color: #FFFFFF;">
<option value="1" selected>Support</option>
<option value="2">Question</option>
<option value="3">Complaint</option>
</select>
Now, to my understanding, the value is the data being posted VIA 'type' - so, in my mind, shouldn't it post that value (1 or 2 or 3) and then in the PHP side, it checks if it isn't 1, 2 or 3?