# Checkbox and dropdown to redirect to a page

**URL:** <https://forum.kirupa.com/t/checkbox-and-dropdown-to-redirect-to-a-page/284163>\
**Category:** Uncategorized\
**Created:** [March 16, 2009, 8:28am UTC](https://forum.kirupa.com/t/checkbox-and-dropdown-to-redirect-to-a-page/284163 "2009-03-16T08:28:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![irkevin](https://avatars.discourse-cdn.com/v4/letter/i/67e7ee/32.png) [@irkevin](https://forum.kirupa.com/u/irkevin)\
**Post date:** [March 16, 2009, 8:28am UTC](https://forum.kirupa.com/t/checkbox-and-dropdown-to-redirect-to-a-page/284163/1 "2009-03-16T08:28:38Z")

</div>

well… have a look at this code

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

```auto

<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

```auto
<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
