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_S ELF'];?>" 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.
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_S
<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.
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>";
}
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
ASKER
had to change it a bit but works thx
Open in new window
Open in new window
I have made spacing proper. I had same problem yesterday, hope it helps.