PHP代码中input控件使用id无法POST传值,使用name就可以

<html>
<head>
<title>Example</title>
</head>
<body>
<?php
if (isset ( $_POST ['input1'] )) {
    echo "input1 = " . $_POST ['input1'];
} else {
    echo "input1 = is not set";
}
if (isset ( $_POST ['input2'] )) {
    echo "input2 = " . $_POST ['input2'];
} else {
    echo "input2 = is not set";
}
?>
    <form method="post" action="/index.php">
        登录用户名<input name="input1" value="" type="text" /> 密码<input
            name="input2" value="" type="password" /> <input name="signin"
            value="登录" type="submit" />
    </form>
</body>
</html>

原文地址:https://www.cnblogs.com/zhang-pengcheng/p/5034233.html