提交表单后,我想在用户类中调用我的函数,到目前为止,我有以下内容:
if(isset($_POST)){
$run = new Users();}
$run->preventaccess();
if(isset($_POST['registerForm'])) {
$run->validate();
$run->insert();
}
if(isset($_POST['loginForm'])) {
$run->login($username, $password);
$run->validatelogin();}
然而这根本不起作用,它把我带到我的课程页面,但页面留空并且查询没有执行?
有什么想法可以让它发挥作用吗?
<form id="loginForm" name="loginForm" method="POST" action="classes/class.Users.php">
<h1><span class="log-in">Log in</span> or <span class="sign-up"><a href="register">sign up</a></span></h1>
<div id="errorDiv"></div>
<p class="float">
<label for="login"><i class="icon-user"></i>Username</label>
<input type="text" id="username" name="username" placeholder="Username">
<span class="errorFeedback errorSpan" id="emailError">Username is required</span>
</p>
<p class="float">
<label for="password"><i class="icon-lock"></i>Password</label>
<input type="password" id="password" name="password" placeholder="Password" class="showpassword">
<span class="errorFeedback errorSpan" id="passwordError">Password is required</span>
</p>
<p class="clearfix">
<input type="submit" name="submit" value="Log in"></form>
</p>