php - $_post does not contain anything -
this question has answer here:
i trying login seems variables dont contain anthing. encountered problem before managed fix , name attribute missing in html form time..but time don't know doing wrong .plz help?
here html snippet. returning blank after submit:
<form action="onlogin.php" method="post"> <h1>login form</h1> <div> <input type="text" placeholder="username" required="" name="username" /> </div> <div> <input type="password" placeholder="password" required="" name="password" /> </div> <div> <input type="submit" value="log in" /> <a href="#">lost password?</a> <a href="signup.html">register</a> </div> </form>
and php snippet is:
<?php include ("config/config.php");//connects db if(isset($_post["submit"])) { $username = $_post['username']; echo "$username"; $password = $_post['password']; echo "$password"; } ?>***
you check $_post["submit"]
submit isset or not in php script. don't send
form.
try this:
<form action="onlogin.php" method="post"> <h1>login form</h1> <div> <input type="text" placeholder="username" required="" name="username" /> </div> <div> <input type="password" placeholder="password" required="" name="password" /> </div> <div> <input type="submit" name="submit" value="log in" /> <a href="#">lost password?</a> <a href="signup.html">register</a> </div> </form>
Comments
Post a Comment