-1

I am not an expert but I am no noob at PHP, yet for whatever reason I am stomped as to why my document will not load. Here is my code.

<?php include 'header.php'; ?>

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Home</title>
</head>

<body>

<p>Hello everyone</p>

</body>

</html>

When I pull out the PHP portion the HTML loads fine. Here is the code in my header.php file.

<?php
<href="index.php">Home</a>
?>

I have tried this on two different hosts, both of which are hosting other PHP websites and still getting issues. I have also validated it with W3Schools and another online PHP validator. Both didn't find any errors. Any help would be greatly appreciated.

3
  • 1
    <href="index.php">Home</a> is not valid HTML Commented May 9, 2014 at 21:03
  • And no valid PHP either ;) Commented May 9, 2014 at 21:04
  • 1
    Basic HTML and PHP 101, not done. Commented May 9, 2014 at 21:09

2 Answers 2

2

Enable errors to see errors, this way:

ini_set('error_reporting', E_ALL);
ini_set('display_errors', true);

This code is a PHP error:

<?php
<href="index.php">Home</a>
?>

Try change to:

<?php
echo '<href="index.php">Home</a>';
?>
Sign up to request clarification or add additional context in comments.

Comments

2

This:

<?php
<href="index.php">Home</a>
?>

Is no valid PHP. This would, however work:

<a href="index.php">Home</a>

Inside of the PHP-tags you can only use PHP - no HTML. Also, <href> is no HTML tag.

Look at this question How to get useful error messages in PHP? to find out, how to enable error messages in PHP.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.