Please help, i am trying to make it so that upon users or guests visiting my webpage they will see a text area which is disabled and once they’ve logged in they can then click to edit this text area.
I have it pretty much set up how i want it but at the moment if a user logs in the text areas are switched from the disabled one to the editable one. but then all the other text areas of the other profiles disappear and i want these to stay so the logged in user can see other users ones but not edit them?
Hope i’ve explained that clearly enough. Hope this is possible?
<?php if (isset($_SESSION['user_id'])) {
if ($user['id'] == $_SESSION['user_id']){
?>
<textarea id="area" rows="10" style="
width: 456px;
margin-top:3px;
text-align:left;
margin-left:-2px;
height: 122px;
resize: none;
border: hidden;"><?php echo $profile['bio'] ?> </textarea>
<?
}
}
?>
<?php
if (!logged_in()) {
?>
<textarea id="area-read" disabled="yes" style="
width: 456px;
margin-top:3px;
text-align:left;
margin-left:-2px;
height: 122px;
resize: none;
border: hidden;"><?php echo $profile['bio'] ?> </textarea>
<?
}
?>
You said for other profiles, the textarea disappears. That is because after the user logs in, his session is set. And only in profiles where
idis equal to the sessionuser_id, the textarea is printed. So you need to handle the else case for theifinside the firstifblock.