Here is what I have going on
I have a Page that we use to update all pages on the site. I want to be able to click a link to dynamically load the content of corrsponding text file into a textarea on a form. We can edit the content in the form, and submit it and it saves the changes to the correct text file. My problem is with my script all changes are hardwired to save to body.txt (home page). the page can be found at http://kromepreview.t35.com/kromehome.php.
Here is the code thus far
Code: Select all
<?php
if ((is_array($_GET)) && isset($_GETї'filename'])) {
$filename = $_GETї'filename'] . '.txt';
$fp = fopen($filename, "r");
$contents = fread($fp, 100000);
fclose($fp);
}
// when the form is submitted, make the edits
if ((is_array($_POST)) && isset($_POSTї'body'])) {
$body = stripslashes($_POSTї'body']);
$handle = fopen('body.txt', 'w');
fwrite($handle, $body);
fclose($handle);
}
?>
<html>
<body>
<a href="kromehome.php?filename=body">Home</a>
<a href="kromehome.php?filename=download">Downloads</a>
<form action="kromehome.php" method="post">
<textarea name="body" cols="32" rows="8">
<?php echo $contents; ?>
</textarea><br />
<input type="submit" name="submit" value="Submit" />
<input type="reset" name="Reset" value="Reset Changes" />
</form>
</body>
</html>