pgrevents Posted May 23, 2009 Share Posted May 23, 2009 Its simple i know but i cannot see the errors of my ways. I am creating a sign up form and I am passing the details via ajax. I know that both variables are sending and getting picked up by the script but its returning false info. Basicly its a validation to check if the user has confirmed their password correctly. here is the code <?php $pass = $_POST['pword']; $check = $_POST['check_pass']; if ($pass == $check) { echo "yes"; } else { echo "no"; } ?> i been staring at this machine all day thats prob why i cant see the error :0 any help?? Quote Link to comment https://forums.phpfreaks.com/topic/159413-simple-if/ Share on other sites More sharing options...
jackpf Posted May 23, 2009 Share Posted May 23, 2009 Try this echo $pass.' - '.$check; And see what's output. Quote Link to comment https://forums.phpfreaks.com/topic/159413-simple-if/#findComment-840904 Share on other sites More sharing options...
razta Posted May 23, 2009 Share Posted May 23, 2009 if ($pass === $check) Maybe that will work? Quote Link to comment https://forums.phpfreaks.com/topic/159413-simple-if/#findComment-840905 Share on other sites More sharing options...
RussellReal Posted May 23, 2009 Share Posted May 23, 2009 <?php $pass = $_POST['pword']; $check = $_POST['check_pass']; if (($pass == $check) && (strlen($pass)) { echo "yes"; } else { echo "no"; } ?> this would be a tad more secure, however, there is no error in ur php.. I think you're sending them as the wrong names you're expecting Quote Link to comment https://forums.phpfreaks.com/topic/159413-simple-if/#findComment-840906 Share on other sites More sharing options...
pgrevents Posted May 23, 2009 Author Share Posted May 23, 2009 Thanks for the hints. I tried every if expresion i could think of and not working. I am sending I know they are getting recieved correctly ill try some fidgeting Quote Link to comment https://forums.phpfreaks.com/topic/159413-simple-if/#findComment-840908 Share on other sites More sharing options...
jackpf Posted May 23, 2009 Share Posted May 23, 2009 Try this echo $pass.' - '.$check; And see what's output. What did that output then? Quote Link to comment https://forums.phpfreaks.com/topic/159413-simple-if/#findComment-840910 Share on other sites More sharing options...
pgrevents Posted May 23, 2009 Author Share Posted May 23, 2009 that was the first thing i done when it wasnt working its the same variables as passed Quote Link to comment https://forums.phpfreaks.com/topic/159413-simple-if/#findComment-840915 Share on other sites More sharing options...
pgrevents Posted May 23, 2009 Author Share Posted May 23, 2009 solved it was the ajax a letter out of place thanks for the help Quote Link to comment https://forums.phpfreaks.com/topic/159413-simple-if/#findComment-840917 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.