Jump to content

Recommended Posts

my footer renders ontop...

 

weird huh?

tested in chrome & firefox

 

 

any idea how to fix?

 

footer.php

<?php
$footer = '<div id="footer" >Copyright &copy 2011 davidknag.com<br/>Part of the <a href="http://www.davidknag.com/">David Knag Network</a></div>'
?>

style.css

a {
text-decoration:none;
color:#888888;
}

a:hover	{
color:#999999;
text-decoration:underline;
}
#footer {
margin-left:60%;
color:#666666;
}
body {
background-color:#191919;
color:#FFFFFF;
}
#box {
color:#000000;
  position: fixed;
  top: 200px;
  left: 32%;
			width:550px;
			background:#afc8de;

			padding:2em 0 2em 0;
			border:solid 10px #1f1f1f;
		 }

form{width:500px; margin:0 auto 0 auto;}
fieldset {border:none; padding:0 0 2em 0;
}
#boxfix{width:500px; margin:0 auto 0 auto;}
fieldset {border:none; padding:0 0 2em 0;
}

 

index.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html>
<head>
<title>Todo</title>
<link rel="stylesheet" href="style.css" type="text/css" media="screen" charset="utf-8"/>
</head>
<body>
<?php
error_reporting(0);
require "mysql.php";
$today = getdate();
if ($_POST['logout']) {
setcookie("loggedin", "0", time()-3600);
}
else {
}
if ($_COOKIE["loggedin"] == 1) {
?>
hi!
<br/>
<form autocomplete="off" action="logout.php" method="POST">
<input value="Log Out" class="logout" type="submit" name="logout">
</form>
<?php
}
else{

$usere = $_POST['user'];
$pwe = $_POST['password'];
if ($_POST['login']){
$qry="SELECT * FROM users WHERE username='$usere' 
AND password='$pwe'";
$result=mysql_query($qry);
if(mysql_num_rows($result)>0) {
echo "<div id='box'><div id='boxfix'>Login Correct! <br/> 1 Second...</div></div>"; 
$expire=time()+60*60*24*30;
setcookie("loggedin", "1", $expire);
header('Location: index.php');
}
else {
echo "<div id='box'><div id='boxfix'><strong>Login Incorrect!</strong><br/>Your Username or Password was Incorrect!</div></div>";
}
}else{

?>
<div id="box">
<form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="POST">
User:<br/><input type="text" name="user"><i>*</i><br/>
Password:<br/><input type="password" name="password"><i>*</i><br/>
<input value="Login" class="submit" type="submit" name="login">
</form>
</div>
<?php include "footer.php";
echo $footer;
?>
<?php 
}
}
?>

</body>
<head>
<html>

Link to comment
https://forums.phpfreaks.com/topic/226935-my-footer-is-ontop/
Share on other sites

The footer is at the top of the page because of your CSS. If you remove the "position:fixed;" from the #box declaration, the footer will appear at the bottom of the page.

 

Note that there is an HTML error also. At the end, this:

 

...
</body>
<head>
<html>

 

Should be:

 

...
</body>
</html>

Link to comment
https://forums.phpfreaks.com/topic/226935-my-footer-is-ontop/#findComment-1170962
Share on other sites

semi-fixed but still at top

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html>
<head>
<title>Todo</title>
<link rel="stylesheet" href="style.css" type="text/css" media="screen" charset="utf-8"/>
</head>
<body>
<?php
error_reporting(0);
require "mysql.php";
$today = getdate();
if ($_POST['logout']) {
setcookie("loggedin", "0", time()-3600);
}
else {
}
if ($_COOKIE["loggedin"] == 1) {
?>
hi!
<br/>
<form autocomplete="off" action="logout.php" method="POST">
<input value="Log Out" class="logout" type="submit" name="logout">
</form>
<?php
}
else{

$usere = $_POST['user'];
$pwe = $_POST['password'];
if ($_POST['login']){
$qry="SELECT * FROM users WHERE username='$usere' 
AND password='$pwe'";
$result=mysql_query($qry);
if(mysql_num_rows($result)>0) {
echo "<div id='box'><div id='boxfix'>Login Correct! <br/> 1 Second...</div></div>"; 
$expire=time()+60*60*24*30;
setcookie("loggedin", "1", $expire);
header('Location: index.php');
}
else {
echo "<div id='box'><div id='boxfix'><strong>Login Incorrect!</strong><br/>Your Username or Password was Incorrect!</div></div>";
}
}else{

?>
<div id="box">
<form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="POST">
User:<br/><input type="text" name="user"><i>*</i><br/>
Password:<br/><input type="password" name="password"><i>*</i><br/>
<input value="Login" class="submit" type="submit" name="login">
</form>
</div>
<?php 
}
}
?>
<?php include "footer.php";
echo $footer;
?>
</body>
</html>

 

css

a {
text-decoration:none;
color:#888888;
}

a:hover	{
color:#999999;
text-decoration:underline;
}
#footer {
margin-left:60%;
color:#666666;
}
body {
background-color:#191919;
color:#FFFFFF;
}
#box {
color:#000000;
  position: fixed;
  top: 200px;
  left: 32%;
			width:550px;
			background:#afc8de;

			padding:2em 0 2em 0;
			border:solid 10px #1f1f1f;
		 }

form{width:500px; margin:0 auto 0 auto;}
fieldset {border:none; padding:0 0 2em 0;
}
#boxfix{width:500px; margin:0 auto 0 auto;}
fieldset {border:none; padding:0 0 2em 0;
}

 

footer.php

<?php
$footer = '<div id="footer" >Copyright &copy 2011 davidknag.com<br/>Part of the <a href="http://www.davidknag.com/">David Knag Network</a></div>'
?>

Link to comment
https://forums.phpfreaks.com/topic/226935-my-footer-is-ontop/#findComment-1171021
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.