I'm having a bit of trouble getting my simple PHP code to execute. All it does is include some HTML into my website that I wish to remain constant.
Here is the PHP file I wish to include:
<div class = "row2col1">
<h2><u> Links </u></h2>
<br/>
<a class="sidebar" href="aboutus.html">About Us</a>
<br/>
<a class="sidebar" href="http://www.yougov.co.uk/">YouGov</a>
<br/>
<a class="sidebar" href="https://www.conservatives.com/">Conservatives</a>
<br/>
<a class="sidebar" href="http://www.labour.org.uk/">Labour</a>
<br/>
<a class="sidebar" href="http://www.libdems.org.uk/">Liberal Democrats</a>
<br/>
<a class="sidebar" href="http://www.snp.org/">SNP</a>
<br/>
<a class="sidebar" href="http://www.bnp.org.uk/">BNP</a>
<br/>
<a class="sidebar" href="http://www.ukip.org/">UKIP</a>
<br/>
<form>
<input type="button" value="Login/Sign Up" onClick="clicked()" />
</form>
</div>
I have saved this as sidebar.php. This is the code for the rest of the website homepage including the php include script:
<!doctype html public "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml-transitional.dtd"
<html>
<head>
<title>Poll Analysis</title>
<link rel="stylesheet" type="text/css" href="style.css" />
<script>
function clicked(){
alert("This is currently under construction. We're sorry");
}
</script>
</head>
<body>
<div class= "main">
<div class = "row1">
<img src="http://i.imgur.com/Jr8K4oz.png" width="100%" height="100%" />
</hr>
</br>
</div>
</div>
<div class = "row2">
<?php include("sidebar.php");?>
<div class = "row2col2">
<h1> ENTER ARTICLE TITLE HERE </h1>
<hr/>
<br/>
<p> Enter article here </p>
<p> Enter article here </p>
<p> Enter article here </p>
<p> Enter article here </p>
<p> Enter article here </p>
<p> Enter article here </p>
<p> Enter article here </p>
<p> Enter article here </p>
</div>
</div>
<footer>
<hr/>
<br/>
<p> Page hosted by <a href ="http://www.000webhost.com/852668.html"> 000webhost </p></a>
<p> © Mark Turner 2015 </p>
</footer>
</body>
</html>
I originally saved this as a .html file, but then I remembered that you have to save it as index.php to get the PHP script to execute. However, when I changed it, I got this in my browser:
Can somebody please tell me what I'm doing wrong (it's probably something really stupid like last time!)
Thanks in advance, Mark Turner :)