zrweber Posted July 28, 2009 Share Posted July 28, 2009 I'm sure this is easy, but I haven't messed with PHP in 2 years and need a huuuugee refresher. But I need something simple. I need a textarea that would show the HTML of another page, and allow you to edit the HTML of that page and save it, thus updating that page. Example: textarea.php has a textarea that shows the source of index.php When you edit and save the changes of the textarea on textarea.php it updates index.php This is really simple I'm sure, I just need a refresher on how I'd go about making this! Thank you very much for your time! Quote Link to comment https://forums.phpfreaks.com/topic/167729-a-textarea-that-shows-the-html-of-another-page/ Share on other sites More sharing options...
lonewolf217 Posted July 28, 2009 Share Posted July 28, 2009 i haven't done much of anything with editing files in php, but i assume you'd do something along the lines of fopen to open the php file, throw the contents into the text area, and then when you hit the submit button or whatever you would save the file and close it. then the next time index.php is opened, it would have the updated contents Quote Link to comment https://forums.phpfreaks.com/topic/167729-a-textarea-that-shows-the-html-of-another-page/#findComment-884515 Share on other sites More sharing options...
.josh Posted July 28, 2009 Share Posted July 28, 2009 use file_get_contents to retrieve the file. Might possibly need to use nl2br on it (I don't remember if textareas render the \n's or not), create a form and just echo it out between the textarea tags. Name the text area, wrap form tags around it. When it is posted, grab it from post and save it to file with file_put_contents Quote Link to comment https://forums.phpfreaks.com/topic/167729-a-textarea-that-shows-the-html-of-another-page/#findComment-884520 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.