This is my first time designing a plugin, so I would appreciate any assistance that you all can provide.
My plugin has a txt file with datetime objects in it. The goal is to read the txt file from a plugin admin page, allow users to edit it, and then save the file once again.
I have no problem reading the file, but I am unable to save it. When I click the button to save it, the browser redirects me somewhere else and doesn't end up saving my file.
EDIT: I should add - this code worked just fine outside of wordpress (as its own PHP page). I can't seem to get it to work with wordpress.
Here is my code. I would greatly appreciate any advice:
if($_POST['addition']){
$file_open = fopen("dates.txt","w+");
fwrite($file_open, $_POST['addition']);
fclose($file_open);
}
echo '<form action="<?=$PHP_SELF?>" method="POST">
<textarea name="addition" COLS=50 ROWS=20>';
$datalines = file ("dates.txt");
foreach ($datalines as $zz) {
echo $zz;
}
echo '</textarea><input type="submit" name="button" value="Save Evenings Before Solemnities File"></form>';
echo '</td>';