aci*_*ing 0 html php html-select drop-down-menu
我在下面的HTML代码中有一个下拉菜单'select',在它下面是用于发送所选选项的PHP.我找不到为什么不发送它.
<p class="input-block">
<label for="contact-enquirytype">
<strong>Drop Menu</strong>
</label>
<select for="contact-enquirytype">
<option type="select" value="Option 1" name="enquirytype" id="contact-enquirytype-1">
Option 1
</option>
<option type="select" value="Option 2" name="enquirytype" id="contact-enquirytype-2">
Option 2
</option>
<option type="select" value="Option 3" name="enquirytype" id="contact-enquirytype-3">
Option 3
</option>
</select>
</p>
Run Code Online (Sandbox Code Playgroud)
和PHP:
$select_enquirytype = strip_tags($_POST['enquirytype']);
Run Code Online (Sandbox Code Playgroud)
我有其他输入文本和广播正在被发送,只有下拉列表没有被发送.
谢谢.
该name属性必须包含在<select>标记中:
<select name="enquirytype">
Run Code Online (Sandbox Code Playgroud)
然后,您必须将其从<option>标签中删除
<option value="Option 1" id="contact-enquirytype-1">
Run Code Online (Sandbox Code Playgroud)