Reputation: 1206
vars.php
<?php
$sometext="text";
?>
index.php
<?php
include ('file1.php');
include ('variables.php');
function genStr() {
$len = 5;
$base='ABCDEFGHKLMNOPQRSTWXYZ123456789';
$max=strlen($base)-1;
$str='';
mt_srand((double)microtime()*1000000);
while (strlen($str)<$len+1) {
$str.=$base{mt_rand(0,$max)};
}
return $str;
}
if(isset($_POST['submit'])){
//processing
}?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>title</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="title" content="title" />
</head>
<body>
</body>
</html>
Now when I check the index.php page with firebug everything from within tags is moved into and there are some white characters added, so there is a rectangle on the top of the page in the browser. When I delete these few invisible characters in firebug, the rectangle dissappears
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head></head>
<body>
" " <!-- white spaces here -->
<title>title</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="title" content=title" />
<body>
Upvotes: 1
Views: 1815
Reputation: 1206
The problem was in the text editor I used (notepad++). When I opened and saved the file in PsPad those characters dissappeared..
Upvotes: 0
Reputation: 91792
You are missing a "
here:
<meta name="title" content=title" />
should be:
<meta name="title" content="title" />
Edit: the only way I can reproduce that, is by outputting anything other than spaces and new-lines before the doctype
. Is php working when you echo
for example something in de body of the page?
Upvotes: 3
Reputation: 146360
try changing your index.php to:
<?php include ('vars.php');?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>...
It should remove that extra line on top
Upvotes: 1