Shahzaib Posted September 29, 2015 Share Posted September 29, 2015 The form file is not redirctng to process2.php file after clickng sign in also when i manually open process2.php file then errors comes like this"undefined user index username and password"............ MAIN FILE (FORM FILE): <form action="process2.php" method="post"> <div class="input-controls"> <input type="text" name="username" placeholder="username"> <span id="person"></span> <div id="clear"></div> </div> <div class="input-controls"> <input type="password" name="password" placeholder="password"> <span id="key"></span> <div id="clear"></div> </div> <div class="input-controls"> <button type="button" id="login-btn" name="signin"> sign in </button> </div> <div id="form-footer"> <a href="#" id="forgot">Forgot Password?</a> <a href="#" id="create">Create an account</a> </div> </form> PROCESS2.PHP FILE <?php $user = $_POST['username']; $pass = $_POST['password']; if($user!=" " && $pass!=" ") { if(isset($_POST['signin'])) { setcookie($name,$user,time()+3600); echo "Cookie is set"; } } else { header('location:form.php'); } ?> I Really Appreciate your replies.thanks in advance Quote Link to comment Share on other sites More sharing options...
mac_gyver Posted September 29, 2015 Share Posted September 29, 2015 (edited) The form file is not redirctng to process2.php file ... header('location:form.php'); the form is probably submitting to process2.php, but process2.php is redirecting back to form.php if($user!=" " && $pass!=" ") ^^^ why are you testing if those two values are not equal to a string consisting of a space " "? wouldn't you want to test each if those values are not an empty string "" and then produce a separate message for each one that is empty? Edited September 29, 2015 by mac_gyver Quote Link to comment Share on other sites More sharing options...
Shahzaib Posted October 21, 2015 Author Share Posted October 21, 2015 but the thing that you are telling is rigth.....but this is not solution...............also what about error of undefined user index 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.