Forum Moderators: coopster
<div id="user_box">
<?php
if(!isset($_SESSION['username']) || (trim($_SESSION['username']) == ''))
echo ("") ;
//header("location: access-denied.php");
else
{
if(isset($_SESSION['username']) && (!empty($_SESSION['username'])))
echo "<font color='white'>" . 'Logged in as '.$_SESSION['username'] . "</font><br>";
echo '<input type="button" align="right" name="logout" value="Logout" onclick="document.location.href=\'logout.php\'"/>';
}
?>
</div> #user_box {
float:right;
width:auto;
height:auto;
margin:0 auto;
align:right;
} position a logout button the right
// I'm not sure what is going on above this . . .
else
{
if(isset($_SESSION['username']) && (!empty($_SESSION['username']))) {
echo '
<form method="get" id="logout-form" action="logout.php">
<p><label for="logout-button">Logged in as '.$_SESSION['username'] . '</label>
<input type="submit" name="logout" id="logout-button" value="Logout"></p>
</form>
';
}
}
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Untitled</title>
<style type="text/css">
#logout-form,#logout-form p { width: 200px; margin:0; padding:0; }
#logout-form label, #logout-button { display: block; white-space: nowrap; }
#logout-form #logout-button { float: right; }
</style>
</head>
<body>
<form method="get" id="logout-form" action="logout.php">
<p><label for="logout-button">Logged in as JohnDoe</label>
<input type="submit" name="logout" id="logout-button" value="Logout"></p>
</form>
</body>
</html>
#user_box {
/*float:right;
width:auto;
height:auto;
*margin:0 auto;*/
}
#logout-form,#logout-form p {
width:10em;
margin:0;
padding:0;
}
#logout-form label, #logout-button {
display:block;
white-space: nowrap;
float: right;
} is not producing a new line which I would have thought it would have done given its function.
but the text is no longer in white