我正在為我的網(wǎng)站創(chuàng)建注冊系統(tǒng)。創(chuàng)建新帳戶時,用戶應(yīng)看到一條消息,即“成功創(chuàng)建了一個新帳戶”;如果無法創(chuàng)建該帳戶,則用戶應(yīng)看到一條消息,顯示“無法創(chuàng)建新帳戶”。我這樣做的目的是,如果用戶不按index.php上的“提交表單”按鈕,他們就會嘗試輸入websitename.com/verify_registration_form.php在搜索欄中,它們被重定向到index.php我的問題是,無論用戶是否按下了提交表單按鈕,該用戶都將重定向到index.php。這是index.php上的注冊表格<form action="verify_registration_form.php" method="post"><input type="username" id="user_name" name="user_name placeholder="Username" required><input type="password" id="user_pass_word" name="user_pass_word" placeholder="Password" required><input type="email" id="user_email" name="user_email" placeholder="Email" required><input type="submit" id="submit_registration_form_button" name="submit_registration_form_button" value="Sign Up"></form>這是我的verify_registration_form.php文件中的表單驗(yàn)證
1 回答

慕工程0101907
TA貢獻(xiàn)1887條經(jīng)驗(yàn) 獲得超5個贊
這將檢查用戶是否已發(fā)布請求:
if($_SERVER['REQUEST_METHOD'] != 'POST')
{
//user didn't press the register button
}
else
{
//user pressed the register button
}
- 1 回答
- 0 關(guān)注
- 203 瀏覽
添加回答
舉報
0/150
提交
取消