I have trouble with spaces, wher is php tag, i have spaces.
foto:
http://img99.imageshack.us/img99/4163/spacervd.png

If i delete: require("connect_db.php");
and
<form method = "post">
...

Everything ok. How i can remowe this space?
And why "New user" in ner rows?

<?php
session_start();
require("connect_db.php");
?>
<html>
<head>
<style type="text/css">
body { 
margin:0; 
margin-top: 0; 
margin-bottom: 0;
text-align: center;
}
div.body2{
width: 666px;
background-color: #e43546;
}
</style>
</head>
<body>
<div class = "body2">
<?php echo 'Text, text<br>'; ?>
<?php 
  echo '
    <form method = "post">
Name: <input type = text name = name>   
  Pass: <input type = password name = password>
  <input type = submit id = login value = login>
  </form>
<a href = "reg.php">New user</a>
';
 ?>
<?php echo 'Text, text<br>'; ?>
</div>
</body>
</html>

Thanks for help

Recommended Answers

All 3 Replies

<?php session_start();
require("connect_db.php"); ?>
<html>
<head>
<style type="text/css">
body { margin:0; text-align: center; } /*top & bottom are redundant*/
.body2{ width: 666px; background-color: #e43546; }
form { margin:0; } 
</style>
</head>
<body>
<div class="body2">
<?php echo 'Text, text<br>';
echo '<form method="post">
Name: <input type="text" name="name">  Pass: <input type="password" name="password">  <input type="submit" id="login" value="login"></form>
<a href="reg.php">New user</a><br>';
echo 'Text, text<br>'; ?>
</div>
</body>
</html>

is there white space in connect_db

connect_db file:

<?php
$db_link = mysql_connect ('localhost', 'root', '');
if($db_link == false){ echo '<br>'; echo 'Error!<br>'; exit;}

$db = mysql_select_db('users');
if($db == false){ echo '<br>'; echo 'Error!'; exit;}
?>

margin:0; - don't help

code for connect_db

<?php
$db_link = mysql_connect ('localhost','root','');
if(!$db_link) { die('<br>'.$mysql_error().'<br>')};
$db = mysql_select_db('users');
if(!$db) { die('<br>'.$mysql_error().'<br>')};
?>

to give a hint should things go wrong
for the code sample previously given I get the images in the attachments, the window border is at the top of the image, margin:0;

can not find a visible whitespace, thinking takes time, back soon

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.