The content of the editor will come in most cases from a POST Request of a form.
<form action="process.php" method="POST">
<textarea name="text" id="editor"></textarea>
<input type="submit" value="Submit" />
</form>
And then in process.php
:
<?php
$content = $_POST['text'];
echo $content;
?>
Of course you have to add some validation to this. However this should give you a simple idea and get you started.
You can also start a google search like this: "form processing php".
EDIT
You need some kind of server-side action to do this. This is not possible with pure HTML! You need to add a server-side backend.
Just a little diagramm to illustrate this:
editor.html
| sends changes to backend
v
backend (changes the contents of the frontend)
|
v
content.html
This is a very poor design (to change the contents of the html file directly) but the principal is the same. In "good" setups you would have a database which holds the contents and the frontend would pull from there and the backend pushes. But with pure HTML this is not possible!
So let me give you some boilerplate:
index.php:
<html>
<head>
<!-- add more stuff here -->
</head>
<body>
<h1>Your Site</h1>
<!-- add more stuff here -->
<p>
<?php
echo file_get_contents('article.txt');
?>
</p>
<!-- add more stuff here -->
</body>
</html>
editor.html:
<html>
<head>
<!-- add more stuff here -->
</head>
<body>
<h1>Your Site - Editor</h1>
<!-- add more stuff here -->
<form action="process.php" method="POST">
<input type="password" name="pwd" placeholder="Password..." />
<textarea name="text" id="editor"></textarea>
<input type="submit" value="Submit" />
</form>
<!-- add more stuff here -->
</body>
</html>
process.php:
<?php
if(!isset($_POST['text']) {
die('Please fill out the form at editor.html');
}
if($_POST['pwd'] !== 'your_password') {
die('Password incorrect');
}
file_put_contents('article.txt', $_POST['text']);
header("Location: index.php");
?>
This is a VERY basic boilerplate and should help you to get started. Tweak it as you go.