theres an element to my php form that allows the user to make multiple selections from a list. i know how to handle multiple selections when the form is submitted, but how do i capture and handle the scenario if no selections are made (i.e. the user should select at least 1 option from the list).
Thanks
null input from multiple selection list
Moderator: General Moderators
default is nothing selected, so when the script is invoked via the submit button
will throw an error no?
i want to catch that and throw it back to the form and inform the user than they did not make any selection.
Code: Select all
$availableSizes = $_POST['availableSizes'];i want to catch that and throw it back to the form and inform the user than they did not make any selection.
Code: Select all
if ( !isset($_POST['availableSizes']) ) {
...
}