Hi,
1) You probably want type="text/css" in your css link e.g.
Code: Select all
<link rel="stylesheet" href="Style.css" type="text/css">
However, this is unlikely to be your problem. You don't show where the php is being executed in relation to your html. If it is executed BEFORE any html is output, then the echo message will appear above the <html> tag and may look like it is at the 'top' of the screen. You can use 'view source' (firefox: cntl-U) to see where your output is in relation to your html.
No amount of css is going to change that!
I suggest:
1) For fatal errors (like you db connection), use die() to terminate output as there is not much point carrying on after printing the message. I like to add a unique error number to help user's report the problem. You could even write your own my_fatal() function to format the msg if you want
2) For non-fatal msg e.g. 'connection established', I suggest you concatenate the messages into a variable and then print it inside a suitable html container e.g.
Code: Select all
<?php
$gsAlert = ''; // Init
$con=mysqli_connect("localhost","u_name","password");
if(mysqli_connect_errno()){
// Fatal error
die ("Error 19201 - Failed to connect to MySQL: ".mysqli_connect_error());
} else {
// Add to alert msg. Note trailing space for nice formatting.
$gsAlert .= "Connection to MySQL via 'instlab' established. ";
}
?>
<html> ...
<body> ...
<div id="alert">
<?php print $gsAlert; // print alert msgs ?>
</div>
...
</body> ...