如何从html脚本代码中获取php中的select-option值?

First, I made script-html including 2 select-option menus as like below.

    <script>
    ....
    var selectedLang1 = document.getElementById('lang1').value;
    var selectedSubject = document.getElementById('subject').value;
    xmlhttp.open("GET","livesearchgroup_"+selectedLang1+"_"+selectedSubject
            +".php?q="+str,true);
   xmlhttp.send();
    }
   </script>

    <select name="lang1" id="lang1">
    <option value="co">한국어</option>
    <option value="en">English</option>

    <option value="af">Afrikaans</option>

    <option value="ar">Arabic</option>

    <option value="az">Azerbaijani</option>

    <option value="be">Byelorussian (Belarusian)</option>
    <option value="bg">Bulgarian</option>
    <option value="bh">Bihari</option>
    </select>

    <select name="subject" id="subject" size="2" style="width:45%;" >
     <option value="a">Infection : bacteria and virus </option>

     <option value="b">Infection : virus, fungus and etc</option>
     <option value="c">Malignant neoplasm</option>
     <option value="d">Benign neoplasm and blood </option>

     <option value="e">Endocrine, nutrition and metabolism </option>
     <option value="f">Mental and behavioral disorders</option>

     <option value="g">Nervous system</option>
     <option value="h">Eye and ear</option>
     <option value="i">Circulatory system</option>
    </select>
    <form>

     <input type="text" size="30" onkeyup="showResult(this.value)">
    </form>
    <div id="livesearchgroup"></div>

And my php code is below.

  <?php
 $lang1=$_POST['lang1'];
 $subject=$_POST['subject'];

 $xmlDoc=new DOMDocument();
 $xmlDoc->load("ds_".$subject."_".$lang1.".xml");

But select-option values don't come to php code. How can I receive those values in php??

The Javascript should be:

    xmlhttp.open("GET","livesearchgroup.php?q="+str+'&lang1='+selectedLang1+"&subject="+selectedSubject,true);

The parameters have to be put after ?, not as part of the script name (unless you have a server rewrite rule that does this automatically).

And in the PHP, you should use $_GET, not $_POST.

Only "selected" value comes through http request, you cant get them all.

Why you don't send those with GET method?

If you want use POST method:

try It:

xmlhttp.open("POST","livesearchgroup.php?q=" + str,true);
xmlhttp.send("lang1=" + selectedLang1 + "&subject=" + selectedSubject + "");