Change the select variable to be an array like so:
<select name="select1[]" size="6" multiple>
Then you can do this:
while (count($select1[])>0){
$value = array_pop($select1);
$query = "insert into table values('$value');
CODE TO INSERT TO DB HERE;
}
That should do it