Different functions check different things about a variable. According to the documentation:
isset()
: Determine if a variable is set and is not NULL.
empty()
: A variable is considered empty if it does not exist or if its value equals FALSE.
array_key_exists()
: returns TRUE if the given key is set in the array
So in your case, if (empty($_POST['cboproduit']))
seems the best way to proceed. It will detect if the value was somehow not transmitted (someone could edit the form in their browser before submitting it) or the empty option was selected.
(Note that this means that there is no way to determine the difference between a variable that does not exist and a variable that is null
.)