As we know, PHP automatically converts parameters to variables. Since selecting multiple items from one selection box, we are essentially creating an array. BUT, PHP does not know this and when we pass selection=monitor&selection=printer&submit=submit, $selection is set to monitor and then $selection is reset to printer.
Here is how we correct this:
We have to inform PHP that we are creating an array so that each time an item is passed to selection, it is really pushed into the end of the array. And, since PHP automatically converts parameters to variables, we can tell PHP that selection is an array by changing <select name="product" multiple>
to <select name="product" multiple>
Now, when the variable is created it is actually $selection (which of course is an array. Now when we submit our request we will get: product = monitor product = printer submit = submit
Remember that product is an array and you have to step through the array to access its elements (notice the section in script.php (our form parser) that has: