How to Include PHP scripts/routines

I’m trying to get a website up and running for a Child Support Calculator.

The calculator is invoked by html (ACSCalcV3.0.html in htdocs folder) with embedded Javascript which, when the calculate button is clicked, should POST data to a PHP routine via the line'POST','ACSCalcV3.0.php',true);
This should then return the html to be displayed and a div<br><br>The entire function being&nbsp;<br><pre class="CodeBlock">`<div>//================================================================================================
<span>// Invoke the PHP CS Calculation routines passing the extracted delimited string and waiting for
</span><span>// the return of the resultant html and then apply this to the results div
</span><span>function calcCS(r) {
</span><span>    var obj = newRequestObject(), msg = document.getElementById('calcdone');
</span><span>    obj.onreadystatechange = function() {
</span><span>        if (obj.readyState == 4) {
</span><span>            if (obj.status == 200) {
</span><span>                rtext = obj.responseText
</span><span>                var b = document.getElementById('results'+AC_browser);
</span><span>                b.innerHTML = rtext;
</span><span>                delete obj;
</span><span>                obj = null;
</span><span>            }
</span><span>        }
</span><span>    }
</span><span>    obj.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
</span><span>    obj.send('CSINFO='+encodeURI(r));
</span><span> = 'block';
</span><span>    setTimeout("document.getElementById('calcdone').style.display='none'",1000);

The Javascript is working fine and a breakpoint on the line that does the POST is reached when the button is clicked (other aspects such as mouseovers in the JavaScript are all working).

I've also checked that PHP itself is enabled using phpinfo.

However, the PHP script/rotine ACSCalcV3.0.0.php which is in a directory called include doesn't appear to be being invoked.

There doesn't appear to be any relevant error messages  and .htaccess includes php_value display_errors On
When the ready state is 4 the status is 0, the statusText is empty as is the responseText. 

The include directory also contains the the Javascript file ACSCalcV3.0.js which is included via the HTML file ACSCalcV3.0.html via the code 


Admittedly this is old code it has been in use since 2008 and other than a single file that should be updated annually has rarely been altered. The code is working fine on a PC at home (not accessible remotely any more) and has been working for years at since 2008.

I checked your account, but I can't find the file ACSCalcV3.0.php. Or maybe I'm just not looking at the right place.

A good place to start would be to open your browser's developer tools, and go to the Network tab. Then, make sure that the PHP script is called from the Javascript code. The HTTP call should appear in the Network tab, allowing you to inspect what data is being sent to the script, and what it returns. The status code of the script is often telling as well.
I checked your account, but I can't find the file ACSCalcV3.0.php. Or maybe I'm just not looking at the right place. 

It's probably more that I was looking in the wrong place.  :):smile:

I think I must have moved it from the home directory to the include directory.

I've now got it working (although I had an issue with the require_once's not liking 


). Just copied the respective files into the home directory and used 


And it appears to be fine (been ages since I've used php)