<script>function login() { var userN = document.getElementById("userN").value; var pin = document.getElementById("pin").value; if (userN == "") { alert("User name not entered"); document.getElementById("userN").focus(); } else if (pin == "") { alert("PIN Number not entered"); document.getElementById("pin").focus(); } else { var userAccount = "User Name:" + userN + "\n" + "Pin:" + pin; alert("userAccount"); } } </script></head><body> <h2>Please enter your User Name and PIN:</h2> <form name="formLogin" action=""> <action="loginLog.php" method="post"> <p><label for="userN">User Name: </label> <input type="text" name="userN" id="userN" size="20" maxlength="8" tabindex="1"></p> <p><label for="pin">PIN Number: </label> <input type="password" name="pin" id="pin" size="20" maxlength="8" tabindex="2"></p> <input type="submit" onclick="return login();" /> <input type="reset" onclick="document.formLogin.userN.focus();" /> </form>我在使用 $_Post 捕獲和回顯以顯示在登錄頁面上提交的數據時遇到問題。我不確定在登錄頁面上獲取此數據以推送到 loginLog.php 我缺少什么這是我的 loginLog.php 文件<body>Welcome<?php echo $_POST["userN"];?><?php echo $_POST["pin"];?></body>
1 回答

元芳怎么了
TA貢獻1798條經驗 獲得超7個贊
不要忘記添加method具有以下值的屬性post:
<form name="formLogin" action="path/to/yourfile/loginLog.php" method="post">
<action="loginLog.php" method="post">
<p><label for="userN">User Name: </label>
<input type="text" name="userN" id="userN" size="20" maxlength="8" tabindex="1"></p>
<p><label for="pin">PIN Number: </label>
<input type="password" name="pin" id="pin" size="20" maxlength="8" tabindex="2"></p>
<input type="submit" onclick="return login();" />
<input type="reset" onclick="document.formLogin.userN.focus();" />
</form>
- 1 回答
- 0 關注
- 104 瀏覽
添加回答
舉報
0/150
提交
取消