我是php的新手,我知道这很简单,但我无法弄清楚我做错了什么。无论我尝试什么,我都无法得到这样的事件'变量以传入电子邮件。
-HTML -
<div class="container">
<form class="form-inline" role="form" method="post" action="this.php">
<div class="form-group">
<div>
<label for="event">What Kind of Event is it?</label><br>
<!--<select name="Event" tabindex="1">-->
<select class="form-control" id="inputEvent">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
</div>
<br>
<br>
<div class="form-group">
<input type="text" class="form-control"
id="inputEmail" name="inputEmail" placeholder="Your Email">
</div><br><br>
<div class="form-group">
<label for="human" control-label>Are you human? 2 + 3 =
?</label><br>
<input type="text" class="form-control" id="human"
name="human" placeholder="Your Answer?">
</div>
<br><br>
<div class="form-group">
<button type="submit" class="btn btn-default"
value="Filter">
Send Message
</button>
</div>
</form>
</div>
this.php
<?php
$event = $_POST['inputEvent'];
$email = check_input($_POST['inputEmail'], "Your E-mail Address");
Email: $email
Event: $event
?>
答案 0 :(得分:3)
这可能令人困惑,但你需要使用&#34; name&#34;属性而不是&#34; id&#34;属性。尝试将表单更改为:
<select class="form-control" name="inputEvent">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>