我已经在一个网站上找到了这个表格。我无法从选择标签中获取值以由 php.ini 上的变量收集。无论选择什么选项,它都会在 PHP 中显示为空白。
每个其他输入值都被它的 php 变量准确收集。
我相信我检查了足够多的拼写错误、未封闭的标签或缺少的字符。这会是我不知道的关于 < select > 标签的某种规则吗?
的HTML
<form method="post" action="contact.php" name="contactform" id="contactform" autocomplete="off">
<fieldset>
<label id="sendtolabel"><span>Send To:</span></label>
<select name="select" id="select">
<option value="1">Option 1</option>
<option value="2">Option 2</option>
<option value="3">Option 3</option>
<option value="4">Option 4</option>
</select>
<label for="name" accesskey="U"><span class="required">Name</span></label>
<input name="name" type="text" id="name" size="30" title="name" />
<label for="email" accesskey="E"><span class="required">Email</span></label>
<input name="email" type="text" id="email" size="30" title="email" />
<label for="comments" accesskey="C"><span class="required">Comments</span></label>
<textarea name="comments" cols="40" rows="3" id="comments" title="comments"></textarea>
<input type="submit" class="submit" id="submit" value="Submit" />
</fieldset>
</form>
PHP的
$select = $_POST['select'];
$name = $_POST['name'];
$email = $_POST['email'];
$comments = $_POST['comments']