JWassall
JWassall

Reputation: 21

PHP - HTML Script being placed within 'body' tags

I have been developing a page on my webserver (using nano on the actual server) and I have been experimenting with the INCLUDE statement as an attempt to hide database details from the end user. However, my html is being placed within BODY tags according to Firefox's Inspector.

Here is the result in firefox and below that is the code for my page.

enter image description here

<?php
include "/database.php";
?>
<DOCTYPE! html>
<html>
<head>
<title><?php echo $minfo['name']; ?></title>
<meta charset="utf-8">
</head>
<body>
<h1>Welcome to my page</h1>
</body>
</html>

If its needed I can also include the "DATABASE.PHP" script.

Upvotes: 0

Views: 161

Answers (1)

DS.
DS.

Reputation: 3014

Try this:

<?php
include "/database.php";
?>
<!DOCTYPE html>
<head>
    <title><?php echo $minfo['name']; ?></title>
    <meta charset="utf-8">
</head>
<body>
    <h1>Welcome to my page</h1>
</body>
</html>

Assumes that $minfo['name'] is defined in your database.php.

Upvotes: 2

Related Questions