Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (isset($_POST['submit'])) {
- $myFile = "123.html";
- $fh = fopen($myFile, 'w') or die("can't open file");
- $stringData = stripslashes($_POST['sf']);
- fwrite($fh, $stringData);
- fclose($fh);
- header('Location: editer.php?a=done');
- }
- ?>
- Inside body:
- <form action="" method="post">
- <textarea name="sf" cols="40" rows="6">
- <?php
- $myFile = "123.html";
- $fh = fopen($myFile, 'r');
- $theData = fgets($fh);
- fclose($fh);
- echo $theData;
- ?></textarea>
- <br />
- <input type="submit" name="submit" value="Edit" />
- </form>
- <?php
- if ($_GET['a'] == 'done') {
- echo 'The file was saved and now it says:<br /><br />';
- $myFile = "123.txt";
- $fh = fopen($myFile, 'r');
- $theData = fgets($fh);
- fclose($fh);
- echo $theData;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement