Jump to content

two && code


johnseito

Recommended Posts

The solution IS simple. How about this: write exactly everything you want for it to do in one consolidated post, perhaps throw in some example conditions for even more clarity. Everything he's posted has been perfectly reasonable. (And please respond to my second sentence, not my first, third or this one, arguing doesn't get your problem fixed faster.)

Link to comment
https://forums.phpfreaks.com/topic/144425-two-code/page/2/#findComment-759459
Share on other sites

If you want separate error messages for improper string length and not matching passwords:

<?php
if($password1 != $password2) {
    echo 'Your passwords do not match!';
}
elseif(strlen(trim($password1)) <= 4) {
    echo 'Your password was not greater than 4 characters!';
}
else {
    echo 'Your password was okay!';
}

 

if you want the comparisons to be combined:

<?php
if($password1 != $password2 || strlen(trim($password1)) <= 4) {
    echo 'Your passwords do not match, or they weren\'t greater than 4 characters';
}

 

Note that I'm just repeating code that has been posted here before, and I can't fathom any other logical alternatives you could have. Before you insult or say this code does not work, try it without editing it then, when it works, try to figure out WHY it works. Simple boolean logic shouldn't result in 2 page threads. If you are going to claim this code does not work, post a proof of concept.

Link to comment
https://forums.phpfreaks.com/topic/144425-two-code/page/2/#findComment-759462
Share on other sites

KingP if you don't understand,, than I don't think you should try to help me.  I don't see what you write as make sense.  Your code earlier I already know, and your not helping at all, your are typing again the same thing earlier and I told you why that is not how I wanted it and it's incorrect. 

 

KingP your are providing a simple solution.. my solution is not as simple as you have it.. so I don't need to check both password length is not right.

 

You heared him KingP, this one must be over your head  ::)

 

hahahaha

Link to comment
https://forums.phpfreaks.com/topic/144425-two-code/page/2/#findComment-759548
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.