Hello, first off, I am a newbie with php (as well as coding in general). I have a website that has user profiles. On these profiles there are areas to comment in. I am trying to toggle 3 types of comment areas depending on
A. If you are signed in and looking at your own profile B. If you are signed in looking at someone elses profile C. If not signed in and looking at any profile
I have 3 text areas and with their own input types ( the third without an input as you don't get to comment if you are not signed in) all set up. I have tried a myriad of if and if else statements. I have been able to get all three work at some points, but for example, C. will have the type it should, and an extra one. The closest I have gotten, which is the code I am about to show is A. and B. are working properly, C. has B.'s charactoristics. I know that things are not escaped etc...but just trying to get the basic functionality working first,and then I will secure and polish.
Here is my code,thanks!
<form name="CommentBox" method="post" action="Profile.php?id=<?php echo $prof->id; ?>">
<?php if($auth->id == $prof->id) { echo "<textarea name='A.'></textarea>
<input type='submit' name='A.' value='Submit' class='post' />";}if($auth->id != $prof->id){
echo "<textarea name='B.'></textarea>
<input type='submit' name='B.' value='Submit' class='post' />";}elseif(!$_SESSION['SITE']['AUTH']) { echo "<textarea name='C.' disabled>Please sign in to comment...</textarea>";
}?>
</form>