irkevin Posted March 15, 2009 Share Posted March 15, 2009 Hi, this seems harder for me. Basically, i have a checkbox, what i want is, check the checkbox, and use the dropdown to redirect to a specific page. Anyone got a working example of that plz? or a good tutorial on this? Help plz. Cheers.. Quote Link to comment https://forums.phpfreaks.com/topic/149530-checkbox-and-dropdown-to-redirect-to-a-page/ Share on other sites More sharing options...
irkevin Posted March 15, 2009 Author Share Posted March 15, 2009 well, this will come from a database, so eventually i will have multiple checkboxes depending on number of rows from mysql database.. thanks for any ideas.. cheers Quote Link to comment https://forums.phpfreaks.com/topic/149530-checkbox-and-dropdown-to-redirect-to-a-page/#findComment-785305 Share on other sites More sharing options...
jackpf Posted March 15, 2009 Share Posted March 15, 2009 What so...you just want it to redirect to another page when someone checks the checkbox? If so, then all you have to do is put something like this... <input type="checkbox" onclick="window.location='page.php';" /> Quote Link to comment https://forums.phpfreaks.com/topic/149530-checkbox-and-dropdown-to-redirect-to-a-page/#findComment-785306 Share on other sites More sharing options...
irkevin Posted March 15, 2009 Author Share Posted March 15, 2009 well.. have a look at this code <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> For now it doesn't work because i have two checkboxes.. 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.. any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/149530-checkbox-and-dropdown-to-redirect-to-a-page/#findComment-785310 Share on other sites More sharing options...
irkevin Posted March 15, 2009 Author Share Posted March 15, 2009 i tried using radio instead of checkboxes, but still no go :S Quote Link to comment https://forums.phpfreaks.com/topic/149530-checkbox-and-dropdown-to-redirect-to-a-page/#findComment-785335 Share on other sites More sharing options...
irkevin Posted March 16, 2009 Author Share Posted March 16, 2009 bump still no one? Quote Link to comment https://forums.phpfreaks.com/topic/149530-checkbox-and-dropdown-to-redirect-to-a-page/#findComment-785637 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.