Jump to content

Recommended Posts

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! :)

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

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.