Cyberspace Posted April 8, 2008 Share Posted April 8, 2008 I am trying to validate a MemberRef and password, im want to check that a MemberRef and password in a table called "members" exists and then also that they match. Can anyone help? I have the following code: <?php if (isset($_POST['submit'])) { $MemberRef_message = ''; $Password_message = ''; $MemberRef = mysql_real_escape_string(stripslashes($_POST['MemberRef'])); $Password = mysql_real_escape_string(stripslashes($_POST['Password'])); $account = mysql_fetch_array(mysql_query("SELECT * FROM members WHERE MemberNo='$MemberRef' && Password='$Password'")); } <hr class="hr_blue"/></p><font face="Arial" size="3">Join Walk</font><form method="post" class="addwalkerform" action=""> </font> <fieldset> <label for="MemberRef">MemberRef:</label> <input readonly name="MemberRef" type="text" id="MemberRef"/><br /> </fieldset><p></p> <fieldset> <label for="username">Password:</label> <input readonly name="username" type="text" id="username" value="<?php echo $_SESSION["username"]; ?>" /><br /> </fieldset><p></p> <fieldset> <p class="submit"> <input type="submit" name="submit" value="Join Walk" /> </p> </fieldset </fieldset> </form> <?php } ?> Link to comment https://forums.phpfreaks.com/topic/100231-memberref-and-password-check/ Share on other sites More sharing options...
EXiT Posted April 8, 2008 Share Posted April 8, 2008 if (isset($_POST['submit'])) { $MemberRef_message = ''; $Password_message = ''; $MemberRef = mysql_real_escape_string(stripslashes($_POST['MemberRef'])); $Password = mysql_real_escape_string(stripslashes($_POST['Password'])); $account = mysql_query("SELECT * FROM members WHERE MemberNo='$MemberRef' && Password='$Password'")); if(mysql_num_rows($account) == 0){ echo "Wrong" } else { } There is no name="Password" in your form either! Link to comment https://forums.phpfreaks.com/topic/100231-memberref-and-password-check/#findComment-512513 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.