This question already has an answer here:
How can i add return confirm in the onchange function? This is want i want to add return confirm('Are you sure?');
<select name='<?php echo "sel".$a; ?>' onchange='this.form.submit()' style='width: 150px'>
</div>
Create a javascript function:
<script type="text/javascript">
function submitForm(form){
if(confirm("Are you sure?")){
form.submit()
}
else{
location.reload()
}
}
</script>
And then adjust your HTML to be:
<select name='<?php echo "sel".$a; ?>' onchange='submitForm(this.form)' style='width: 150px'>