PHP没有得到与$ _POST的select信息

我正在创build一个生成excel文件的网页,我想select英文和法文之间的语言。 所以,在那个页面中,我有两个selectinput,其中一个是语言select器。 另一个是在教练机上。

我打电话给他们在PHP中:

 $formateur=$_POST['nomFormateur']; $query1="select * from formateur where formateurId=$formateur"; $info=info_query($query1); $nomFormateur=$info['formateur']; $lang=$_POST['lang']; $date1=$_POST['date_debut']; $date2=$_POST['date_fin']; 

当我select所有我想要的: 我的select

PHP,没有采取我的第二select (语言之一)的价值:

 <td> <select name="nomFormateur" id="nomFormateur" class="name"> <option value=""></option> <?php $query="select * from formateur"; $rows=get_array($query); foreach($rows as $value) { echo '<option value='.$value['formateurId'].'>'.$value['formateur'].'</option>'; } ?> </select> </td> <td align="left"><font size="2" color="gray">Langue :</font></td> <td> <select name="lang" id="lang" onChange="name_click()"> <option value="0">-----</option> <option value="1">Anglais</option> <option value="2">Francais</option> </select> </td> 

当我的Excel文件打开时,我看到了很好的教练,好日子,但仍然是英语的语言,我select,没有什么,英语或法语。 但如果我select英语(价值1),我希望如果select英语,但如果我select法语(价值2),它是法语的,而不是英语。

这是唯一的想法,不工作。 我在mysql中做了两个不同的调用,把这个excel用英文或法文,就这个<select>

我尝试使用Javascript,它显示了我在testing时通过了一个input和一个警报的好的答案,但仍然无法获得在PHP中的信息

Javascriptfunction:

 function name_click(){ var value_select = document.getElementById("lang").value; document.getElementById("my_var").value=value_select; } 

有人可以帮助我吗?

也许,这是因为你忘了closures第一个select标签? 我很确定这与此有关;)

这个javascript函数是不必要的,因为select会自动获得值。 可能这是问题所在。

它看起来像你有select嵌套select?

谢谢你的帮助! 当我在等待并find一些东西的时候,我正在寻找答案。 这是我的select不是一个数组

  <select name="lang" id="lang"> <option value="">-----</option> <?php $array = array("Anglais", "Francais"); $lengh=count($array); for($x=0;$x<$lengh;$x++){ echo '<option value='.$x.'>'.$array[$x].'</option>'; } ?> </select> 

现在,PHP采取$ lang的价值和excel采取我想要的语言