here is the HTML code:
<form action="/Applet/Operator/admin.php" method="post" name="addAdmin">
<fieldset>
<legend></legend>
<label for="name">:<input type="text" name="name" id="name" placeholder=""></label><br>
<label for="pwd">:<input type="password" name="pwd" id="pwd" placeholder=""></label><br>
<label for="pos">:
<select name="pos" id="pos" form="addAdmin">
<option value="1"></option>
<option value="2"></option>
<option value="3" selected="selected"></option>
</select>
</label>
<input type="submit" value="">
</fieldset>
</form>
here is the PHP code:
$name = $_POST["name"];
$pwd = hash("sha256",$_POST["pwd"]);
$pos = $_POST["pos"];
var_dump($_POST["pos"]);
output result: where the 6th and 7th behaviors $pos are
Notice: Undefined index: pos in E:\8.0_2.4_7.2\www\Applet\Operator\admin.php on line 6
Notice: Undefined index: pos in E:\8.0_2.4_7.2\www\Applet\Operator\admin.php on line 7
NULL
ask: Why is it that in the same form, the value of the input tag can be received into the $_ POST array, while select cannot?
I didn"t set disable, for select or put the name attribute in the option tag.
searched for a long time, did not find the reason, hope to solve the doubt!
(attached: PHP version 7.2)