Through searching myself I've found solutions to send HTML data to PHP which I have already done however, I want to get data from an XML file that is accessed by a PHP script into a HTML file due to the format it is in. This is my current attempt. This does not work, where am I going wrong?
<div class="w3-container w3-red w3-cell">
<h4>Todays Projections</h4>
<p>#OUTPUT THE CURRENT DATE + PROJECTION</p>
<?php
$xml=simplexml_load_file("XMLtest.xml") or die("Error: Cannot create object");
$nodes = $xml->xpath("/february/finances[@date='". date("d-m-Y") . "']");
echo "Date: ";
$attr = $nodes->attributes();
echo $attr['date'];
echo "<br> Projection: ";
echo $nodes->projection . ",<br>Recommended Staff: ";
echo $nodes->recommendedStaff . ",<br>Staff Wages: ";
echo $nodes->staffWages . ",<br>Actual: ";
echo $nodes->actual . "<br>";
?>
</div>
Sample XML:
<february>
<finances id="48" date="17-02-2017">
<projection>101</projection>
<recommendedStaff>10</recommendedStaff>
<staffWages>101</staffWages>
<actual>101</actual>
</finances>
<finances id="49" date="18-02-2017">
<projection>101</projection>
<recommendedStaff>10</recommendedStaff>
<staffWages>101</staffWages>
<actual>101</actual>
</finances>
<finances id="50" date="19-02-2017">
<projection>101</projection>
<recommendedStaff>10</recommendedStaff>
<staffWages>101</staffWages>
<actual>101</actual>
</finances>
</february>
Edit: PHP is working within other files hosted on the server and through my account. However I can't get it work in a HTML file like shown above.