Thread: Edit web page from HTML link
Results 1 to 2 of 2
Related
-
How do you use the “include function” to put a HTML Page (top.htm) onto a PHP Page? Forum: PHP Forum
Replies: 1 -
I used Javascript now I cant edit my page PLEASE HELP!! Forum: Javascript Forum
Replies: 1 -
Passing variables from HTML page to page Forum: HTML Forum
Replies: 1 -
multi-level JavaScript document.write / html page within a html page Forum: Javascript Forum
Replies: 7
-
11-12-2010, 01:10 AM #1
Edit web page from HTML link
I am trying to open an existing web page to edit and save from a web page button.
I have initial web pages setup as informational and wish to update the pages without logging into server and using notepad.
I want to click on a button to edit and another to post or save.
-
12-04-2010, 10:29 AM #2
Re: Edit web page from HTML link
Hello! Here is a PHP (I really don't know how to do it with JS) code sample:
PHP Code:<!-- PUT THIS IN BODY -->
<?php
if (isset($_POST['contents'])) {
$fh=fopen($_POST['file_name'],'w');
fwrite($_POST['contents']);
fclose($fh);
echo("File Saved!");
} else {
$text = file_get_contents(/*put filename here OR send this as a post from form (method=post) with filename text's name = file_name*/$_POST['file_name']/*or put 'FNAME' or $_GET['file_name'] with get or like: edit.php?file_name=FNAME*/);
echo("<form action='edit.php' method='post'>"); //form
echo("<textarea name='contents'>"); //textarea
echo($text);
echo("</textarea>"); //end textarea
echo("<input type='hidden' value='".$_POST['file_name']."' name='file_name' />"); //filename
echo("<input type='submit'>");
echo("</form>"); //end form
}
?>