Link to home
Start Free TrialLog in
Avatar of helpchrisplz
helpchrisplz

asked on

was working now not :S echo in html

i have this div that is positioned nice on my banner
but the php echo is not echoing where the div is positioned on the page. its echoing at the very top of the page even though i put the php in the div.


here is the code:

<?php
session_start();
if(isset($_POST['submit1'])) {
logout();
}
?>

<div id="apDiv6"><!-- logout echo here-->
<?php

function logout()
{

      if ($_SESSION['u_name'])
      {
            session_destroy();
      echo "You've been logged out.";}
      else{
            echo "You where not logged in!";
            }        
}
?>
</div>

<div id="two"><!-- logout button here-->

<form action="<?=$_SERVER['PHP_SELF'];?>" method="POST">
<table width="65" border="0" cellpadding="1" cellspacing="3" class="table1">
<td width="57">
<input type="submit" name="submit1" value="Log out"></td>
</table>
</form>
</div>

#apDiv6 {/*css postitions for my echo*/
      position:absolute;
      width:458px;
      height:45px;
      z-index:4;
      left: 183px;
      top: 61px;
}
i allso have some more css for the button here to. what i show here is just a part of my code

so how come the echo is not displayed where i placed the div?
i just want my echo to be displayed in the place i want to position it at :( was working a few hours ago.
Avatar of florjan
florjan

      if ($_SESSION['u_name'])
      {
            session_destroy();
      echo "You've been logged out.";}
      else{
            echo "You where not logged in!";
            }    

Open in new window

 if ($_SESSION['u_name']) {
	session_destroy();
	echo "You've been logged out.";}
else{
	echo "You where not logged in!";
}    

Open in new window


I have made spacing proper. I had same problem yesterday, hope it helps.
Avatar of helpchrisplz

ASKER

i try that and nothing changes
What if you add <p> and </p>.
if ($_SESSION['u_name']) {
        session_destroy();
        echo "<p>You've been logged out.</p>";
}else{
        echo "<p>You where not logged in!</p>";
}  

Open in new window

Also I have rewrote the code and made it nicer if you're interested (you want to put echo after the logout button right?).
ASKER CERTIFIED SOLUTION
Avatar of florjan
florjan

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Ups a mistake on line 19 of code in my last post. Should be You were not logged in instead of You've been logged out
had to change it a bit but works thx