[英]drop down value not post
Thanks to some help here, I have a drop down in an html form. 感谢这里的一些帮助,我有一个html格式的下拉列表。
<p>
<select id="CategorySelection">
<option value="0">Choose One</option>
<option value="Research">Research</option>
<option value="Innovation">Innovation</option>
<option value="Application">Application</option>
<option value="Integration">Integration</option>
</select>
</p>
Depending on what you choose - javascript shows different questions to follow this. 根据您的选择 - javascript会显示不同的问题。 The following questions and everything else are posting to the db (mysql) table fine. 以下问题和其他所有问题都可以发布到db(mysql)表中。 I can't get this value to post- it just shows NULL. 我无法得到这个值后它只显示NULL。 Is there something I am missing because of the javascript? 因为javascript,我有什么遗漏吗? I am really new in that area. 我在那个领域真的很新。 Thanks! 谢谢!
$_POST values derive from the name attribute, not the id. $ _POST值派生自name属性,而不是id。 Your select just needs a name, like this: 你的选择只需要一个名字,如下所示:
<select name="CategorySelection" id="CategorySelection">
Then you can access its value in the $_POST array as usual: 然后您可以像往常一样在$ _POST数组中访问它的值:
if (isset($_POST['CategorySelection'])){
$category = $_POST['CategorySelection'];
}
您将select属性“id”设置为一个值,您需要为其设置“name”属性,然后从PHP的$ _POST数组中调用该键。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.