manuelV Posted August 17, 2011 Share Posted August 17, 2011 Hi, I wanna start out by saying that I know very limited and that I did not come up with this code (Although I edited it to fit what I needed) the code basically, what it does is the person picks one out of four radio buttons, and depending on which button they choose, a dropdown menu will show different values. But when I hit the "Send" button, all the variables and values of the Inputs inside the form are sent into the URL. How come it's doing this? Is there a way to stop this from happening, in such a way that it just sends you to the other page like it's supposed to? This is the code <script language="javascript"> window.document.getElementById("noOptions").style.display = "block"; window.document.getElementById("allOptions").style.display = "none"; function changeOptions() { var form = window.document.getElementById("form"); var north = window.document.getElementById("north"); var south = window.document.getElementById("south"); var metis = window.document.getElementById("metis"); var general = window.document.getElementById("general"); window.document.getElementById("noOptions").style.display = "none"; if (form.radioButton1.checked) { south.style.display = "none"; general.style.display = "none"; metis.style.display = "none"; north.style.display = "block"; north.selectedIndex = 0; } else if (form.radioButton2.checked) { north.style.display = "none"; general.style.display = "none"; metis.style.display = "none"; south.style.display = "block"; south.selectedIndex = 0; } else if (form.radioButton3.checked) { north.style.display = "none"; general.style.display = "none"; south.style.display = "none"; metis.style.display = "block"; metis.selectedIndex = 0; } else if (form.radioButton4.checked) { north.style.display = "none"; metis.style.display = "none"; south.style.display = "none"; general.style.display = "block"; general.selectedIndex = 0; } } window.document.getElementById("radioButton1").onclick = changeOptions; window.document.getElementById("radioButton2").onclick = changeOptions; window.document.getElementById("radioButton3").onclick = changeOptions; window.document.getElementById("radioButton4").onclick = changeOptions; </script> Quote Link to comment https://forums.phpfreaks.com/topic/244964-form-sending-variables-to-the-url/ Share on other sites More sharing options...
codefossa Posted August 17, 2011 Share Posted August 17, 2011 In the HTML, change the form method to "post" instead of "get". Quote Link to comment https://forums.phpfreaks.com/topic/244964-form-sending-variables-to-the-url/#findComment-1258479 Share on other sites More sharing options...
manuelV Posted August 17, 2011 Author Share Posted August 17, 2011 Wow, I can't believe it was that simple... I actually just forgot to add the method. I added POST and it works now.. Quote Link to comment https://forums.phpfreaks.com/topic/244964-form-sending-variables-to-the-url/#findComment-1258826 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.