supermerc Posted February 17, 2008 Share Posted February 17, 2008 Hi, Im trying to make a login form, but for some reason its not working, it goes to the page its supposed to in the action but then does nothing when it gets to that page. This is my form: <form method="post" action="log.php" name="form"> <input type="text" class="text-inp" name="email" id="email" value="EMAIL" /> <input type="password" class="text-inp" name="password" id="password" value="PASSWORD" /> <input type="image" src="./images/button_input_bg.gif" class="button" onclick="document.form.submit()" name="login" value="" /> </form> Then this is my log.php file: <?php session_start(); include 'config.php'; if(isset($_POST['login'])) { $email = trim(addslashes($_POST['email'])); $password = md5(trim($_POST['password'])); $query = mysql_query("SELECT * FROM users WHERE email = '$email' AND password = '$password' LIMIT 1") or die(mysql_error()); $row = mysql_fetch_array($query); if(mysql_num_rows($query) > 0) { if($row['activated'] > 0) { header("Location: member.php"); exit(); } else { echo 'account not activated'; } } else { echo 'bad pass'; } } ?> it seems to me that it doesnt see that the form was submited but I dont understand why. Quote Link to comment Share on other sites More sharing options...
supermerc Posted February 17, 2008 Author Share Posted February 17, 2008 bump Quote Link to comment Share on other sites More sharing options...
Stooney Posted February 17, 2008 Share Posted February 17, 2008 instead of checking for the submit button in the post array, check for the email or add a hidden field to check for. Checking for the submit button isn't reliable. So.. if(isset($_POST['email'])) Quote Link to comment Share on other sites More sharing options...
smithmr8 Posted February 17, 2008 Share Posted February 17, 2008 I have never used a submit button in my login scripts. Try removing the if(isset($_POST['login'])) {} statement for starters. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.