I have this:
case true:
echo '<textarea rows="2" cols="35" name="message_friend" id="message_friend"></textarea>';
break;
default:
echo '<textarea rows="2" cols="35" name="message_friend" id="message_friend" readonly="readonly"></textarea>';
break;
I am trying to ONLY if it's true, then show normal else do READONLY.
The switch is checking from a function
switch( ( check_friend_state($showU["id"], 'friend') ) )
And I tried to echo the function, and it returned err2 and not true, so why does it run true?
I also tried if/else
if(check_friend_state($showU["id"], 'friend') == true){
echo '<textarea rows="2" cols="35" name="message_friend" id="message_friend"></textarea>';
}else{
echo '<textarea rows="2" cols="35" name="message_friend" id="message_friend" readonly="readonly"></textarea>';
}
But as said previously it returns "err2" and still it runs true?
My function at the return:
if($USER == $uID){ // not yourself
return "err1";
}elseif( $checkIsFriend->rowCount() == 1 ){ // already friends
return "err2";
}elseif( $checkAlready->rowCount() == 1 ){ // already send a request
return "err3";
}elseif( $checkBlock->rowCount() == 1 ){ // blocked
return "err4";
}else{
return true;
}
switch((check_friend_state($showU["id"], 'friend') == true))... wow.caseconstruct. Also no one has to ask for any comments on SO. It's an open website.