为了账号安全,请及时绑定邮箱和手机立即绑定

即使已设置submit_registration_form_button,也将用户重定向到

即使已设置submit_registration_form_button,也将用户重定向到

PHP
肥皂起泡泡 2021-05-05 10:10:04
我正在为我的网站创建注册系统。创建新帐户时,用户应看到一条消息,即“成功创建了一个新帐户”;如果无法创建该帐户,则用户应看到一条消息,显示“无法创建新帐户”。我这样做的目的是,如果用户不按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文件中的表单验证
查看完整描述

1 回答

?
慕工程0101907

TA贡献1887条经验 获得超5个赞

这将检查用户是否已发布请求:


    if($_SERVER['REQUEST_METHOD'] != 'POST')

    {

        //user didn't press the register button

    }

    else

    {

        //user pressed the register button

    }


查看完整回答
反对 回复 2021-05-07
  • 1 回答
  • 0 关注
  • 130 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信