First of all, rename your select field to end with []; then $_POST['selectName'] will be an array of the selected values.
Now, since that is coming from the outside world, we need to check its validity.
$selectName = array();
foreach($_POST['selectName'] as $selected)
if(is_int($selected) $selectName[]=$selected;
And if count($selectName)>0, stick it into the MySQL query
"...WHERE thefield IN (".join(',',$selectName).")"