Jump to content

Form sending variables to the URL?


manuelV

Recommended Posts

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>

Link to comment
https://forums.phpfreaks.com/topic/244964-form-sending-variables-to-the-url/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.