非常简单的代码,但是 $race 的下拉值不会回显。$name 回声很好。我错过了什么?先感谢您。
<?php
if (isset($_POST['peeps'])) {
$race = $_POST['race'];
$name = $_POST['name'];
echo $race;
echo "<br>";
echo $name;
}
?>
<form action="x_test.php" method="post">
<select name="race">
<option value="">alien</option> //will not echo if selected
<option value="">earthling</option>
</select>
<input type="text" name="name" value="" id="name" /> //echos fine when filled out
<input type="submit" name="peeps" value="+" />
</form>