Checkbox and dropdown to redirect to a page

well… have a look at this code

For now it doesn’t work because i have two checkboxes…


<script type="text/javascript">
function validate(){
  if (document.test.chk.checked == true)
  {
   if(document.test.sl.selectedIndex == 0)
   {
      location.href = "http://www.mu-anime.com/index.php?id=" + document.test.chk.value;
   }
   else if(document.test.sl.selectedIndex == 1)
   {
      location.href = "http://www.mu-anime.com/index.php?id=" + document.test.chk.value;
   }
  }
}
</script>
</head>
<body>
<form name="test">
<input type="checkbox" name="chk" value="1">1
<input type="checkbox" name="chk" value="2">2
<select name="sl" onblur="return validate();">
   <option>google</option>
   <option>waaa</option>
</select>
</form>

but this one works, when only with one checkbox

<script type="text/javascript">
function validate(){
  if (document.test.chk.checked == true)
  {
   if(document.test.sl.selectedIndex == 0)
   {
      location.href = "http://www.mu-anime.com/index.php?id=" + document.test.chk.value;
   }
  }
}
</script>
</head>
<body>
<form name="test">
<input type="checkbox" name="chk" value="1">1
<select name="sl" onblur="return validate();">
   <option>google</option>
   <option>waaa</option>
</select>
</form>

I will need this to work even if i have multiple checkbox because the checkboxes are being generated by php based on number of rows in database.

Basically, what i want is,

check one checkbox, and use the dropdown to redirect to a specific page with the id append on the url … like

index.php?id='id_of_checkbox_value_here

Help plz