title: add variable in action in a form
body: <p>I'm trying to learn HTML and PHP. In an example which i found over the internet i need to set a variable to the submit button. So when the submit button is pressed, this page reloads, with a variable in the address bar,the variable is the one from the drop down menu. like this :</p>
  
  <pre><code>test.php?idneeded=$variable
  </code></pre>
  
  <p>in which the $variable is selected by the user and then the page reloads to show specific content related to the chosen option.</p>
  
  <p>For example :</p>
  
  <pre><code>test.php?idneeded=40
  </code></pre>
  
  <p>(40 is "MadTechie" from the drop down form)</p>
  
  <p>the code i found is this :</p>
  
  <pre><code>&lt;?php
     if( isset($_GET['ajax']) )
     {
        //In this if statement
        switch($_GET['ID'])
        {
           case "LBox2":
              $Data[1] = array(10=&gt;"-Tom", 20=&gt;"Jimmy"); 
              $Data[2] = array(30=&gt;"Bob", 40=&gt;"-MadTechie");
              $Data[3] = array(50=&gt;"-One", 60=&gt;"Two");
           break;
  
           //Only added values for -Tom, -MadTechie and -One (10,40,50)
           case "LBox3":
              $Data[10] = array(100=&gt;"One 00", 200=&gt;"Two 00");
              $Data[40] = array(300=&gt;"Three 00");
              $Data[50] = array(1000=&gt;"10000");
           break;
        }
  
        echo "&lt;option value=''&gt;&lt;/option&gt;";
        foreach($Data[$_GET['ajax']] as $K =&gt; $V)
        {
           echo "&lt;option value='$K'&gt;$V&lt;/option&gt;\n";
        }
        mysql_close($dbh);
        exit; //we're finished so exit..
     }
     $Data = array(1=&gt;"One", 2=&gt;"Two", 3=&gt;"Three");
     $List1 = "&lt;option value=''&gt;&lt;/option&gt;";
     foreach($Data as $K =&gt; $V)
     {
        $List1 .= "&lt;option value='$K'&gt;$V&lt;/option&gt;\n";
     }
  ?&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /&gt;
  &lt;title&gt;Simple Dymanic Drop Down&lt;/title&gt;
  &lt;script language="javascript"&gt;
     function ajaxFunction(ID, Param)
     {
        //link to the PHP file your getting the data from
        //var loaderphp = "register.php";
        //i have link to this file
        var loaderphp = "&lt;?php echo $_SERVER['PHP_SELF'] ?&gt;";
  
        //we don't need to change anymore of this script
        var xmlHttp;
        try
         {
           // Firefox, Opera 8.0+, Safari
           xmlHttp=new XMLHttpRequest();
         }catch(e){
           // Internet Explorer
           try
           {
              xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
           }catch(e){
              try
              {
                 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
              }catch(e){
                 alert("Your browser does not support AJAX!");
                 return false;
              }
           }
        }
  
        xmlHttp.onreadystatechange=function()
        {
           if(xmlHttp.readyState==4)
             {
                //the line below reset the third list box incase list 1 is changed
                document.getElementById('LBox3').innerHTML = "&lt;option value=''&gt;&lt;/option&gt;";
  
                //THIS SET THE DAT FROM THE PHP TO THE HTML
              document.getElementById(ID).innerHTML = xmlHttp.responseText;
             }
        }
         xmlHttp.open("GET", loaderphp+"?ID="+ID+"&amp;ajax="+Param,true);
         xmlHttp.send(null);
     }
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;!-- OK a basic form--&gt;
  &lt;form method="post" enctype="multipart/form-data" name="myForm" target="_self"&gt;
  &lt;table border="0"&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;!--
        OK here we call the ajaxFuntion LBox2 refers to where the returned date will go
        and the this.value will be the value of the select option
        --&gt;
        &lt;select name="list1" id="LBox1" onchange="ajaxFunction('LBox2', this.value);"&gt;
        &lt;?php 
           echo $List1;
        ?&gt;
        &lt;/select&gt;
     &lt;/td&gt;
      &lt;td&gt;
        &lt;select name="list2" id="LBox2" onchange="ajaxFunction('LBox3', this.value);"&gt;
           &lt;option value=''&gt;&lt;/option&gt;
              &lt;!-- OK the ID of this list box is LBox2 as refered to above --&gt;
        &lt;/select&gt;
     &lt;/td&gt;
     &lt;td&gt;
        &lt;select name="list3" id="LBox3"&gt;
           &lt;option value=''&gt;&lt;/option&gt;
              &lt;!-- OK the ID of this list box is LBox3 Same as above --&gt;
        &lt;/select&gt;
     &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
    &lt;input type="submit" name="Submit" value="Submit" /&gt;
  &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I haven't started learning JavaScript, and i need this for a project. I'll appreciate it if anyone can help me on this.</p>
  
  <p>Thanks.</p>