The user selects a button. Through the method post, and an if statement, some PHP is executed. The code to illustrate this is as follows:
<?php
function onClickArchive(){
$relative_path = "load_more/newfile.php";
$myfile = fopen($relative_path, "a") or die("Unable to open file!");
$txt = "testing\n";
fwrite($myfile, $txt);
$txt = "testing\n";
fwrite($myfile, $txt);
fclose($myfile);
}
if(isset($_POST['load_more'])){
onClickArchive();
}
?>
<div id="reload_section">
<center><br />
<form method="post">
<input type="submit" value="Load More" name="load_more" class="load_more_content" />
</form>
</center>
</div>
When the user select the button and the PHP is executed, the following error occurs:
I think that the PHP cannot find the "load_more" directory - is this the case? And if so, is there any way I can fix it?
My Directory looks like the following illustration:
-----------------------------
load_more(folder)
newfile.php
-----------------------------
archive_general.php
-----------------------------
archive(folder)
archive_main_body.php
-----------------------------
The page that the PHP fopen code is implemented onto is the archive_main_body.php.
However, the archive_main_body.php page has been included in the archive_general.php page - which is the page that the error occurs on.