dezkit Posted August 4, 2008 Share Posted August 4, 2008 <?php if (isset($_POST['submit'])) { file_put_contents('test.php', $_POST['textarea']); header("Location: edit.php "); } else { $index = file_get_contents("test.php"); ?> <html> <title>Read Data</title> <form name="change" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <textarea name="textarea" cols="80" rows="20"><?php echo htmlentities($index); ?></textarea> <input type="submit" name="submit"> </form> </html> <?php } ?> Quote Link to comment Share on other sites More sharing options...
DarkWater Posted August 4, 2008 Share Posted August 4, 2008 What? You don't need the header call, nor do you need the link. O_O Quote Link to comment Share on other sites More sharing options...
dezkit Posted August 4, 2008 Share Posted August 4, 2008 yes he does. Quote Link to comment Share on other sites More sharing options...
DarkWater Posted August 4, 2008 Share Posted August 4, 2008 No he doesn't, he's already on the page, because that's where the form submits to. O_O Quote Link to comment Share on other sites More sharing options...
ngreenwood6 Posted August 4, 2008 Author Share Posted August 4, 2008 Reply what is your suggestion darkwater. I want to thank everyone for their contribution and let it be known that this is one of the best communities out there for helping noobs with their coding. I will be making a contribution very shortly. Quote Link to comment Share on other sites More sharing options...
DarkWater Posted August 4, 2008 Share Posted August 4, 2008 Well, you're already on the page because that's where the form submits to...So you should need to link or send a header. Just remove the else { line and its closing brace. Quote Link to comment Share on other sites More sharing options...
ngreenwood6 Posted August 4, 2008 Author Share Posted August 4, 2008 Thanks that works perfectly. However I have found that if I close out of the page and go back to it it doesnt show my changes unless I hit refresh, but when i submit them it does. Anyone know how to make it refresh the page on return? Quote Link to comment Share on other sites More sharing options...
ngreenwood6 Posted August 4, 2008 Author Share Posted August 4, 2008 Anyone? Quote Link to comment Share on other sites More sharing options...
dezkit Posted August 4, 2008 Share Posted August 4, 2008 can you elaborate please Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.