php - How To Retrieve password From HTML Form and Then Print It -
Well, I'm working on a new project that has a login page. Error: I'm unable to retrieve passwords from the form using the $ _POST method. Form code:
& lt; Form action = "logininsub.php" method = "post" & gt; & Lt; Input type = "password" name = "pass" id = "pass" /> gt; & Lt; Br / & gt; & Lt; Input type = "submit" value = "go!" / & Gt; & Lt; / Form & gt; Code in codeinsub.php
& lt;? Echo $ _POST ['pass']; ? & Gt; I have also tried to use this method instead of password and it works. But what is the problem with password? When I fill out the form and submit it, the next page does not show anything!
OK, now, it's working! Thank you all, the real problem was: I want to take a password from a login form and then want to use mysql_query (php) to see if the username and password combination are or not. If I'm not mistaken, then the code is for:
need_once ('dbconfig.php'); $ Username = $ _POST ['Username']; $ Pass = $ _POST ['pass']; $ Dbc = mysql_connect ($ dbserver, $ dbuser, $ db password); Mysql_select_db ('hello'); $ Query = "SELECT * user WHERE user name = '$ username' and password = password ('$ pass')"; $ Result = mysql_query ($ query); $ Line = mysql_num_rows ($ result); If ($ line == 1) {echo "username and password are correct"; } Else {echo "Error! Username and password are incorrect!"; } Is the code correct? When I execute it, enter the correct username and password (which is present in the database, I get the wrong message, but then when I enter the wrong user name and password, I still get the correct message. ?
Do not you really want to print passwords in your application? Anyway, Code> $ _ POST array - do you submit your submissions page By entering
var_dump ($ _POST); , you can paste the output
Comments
Post a Comment