Reputation: 3234
I am making a textEditor website just for fun for me and I got most of what I am going to do down. But now, I am wondering I am having issue with a transfer of data by _GET
method in php and won't write to my files if it is <
(<). It has to be <
for some odd reason. Is there an easy method to override this when it transfer it? I could find some way, but wanted to know if there was a simple way.
EDITOR FILE:
<html>
<head>
<title>Web Editor</title>
<link href="controller.css" rel="stylesheet"/>
<script type="text/javascript" src="script/editor.js"></script>
</head>
<body>
<div class="platform">
<div class="head"><div class="file"><p>File: <div id="file">hello.html</div></p></div></div>
<div class="hotbar"><img src="images/save.png" class="hotbarImage" onClick="save()" />
</div>
<div class="editor"><div contenteditable="true" style="height:100%; overflow:scroll;" id="editPad" ></div></div>
</div>
</body>
</html>
PHP FILE:
<?php
$dir = $_GET['dir'];
$data = $_GET['data'];
$f = fopen($dir,"w");
fwrite($f,$data);
fclose($f);
?>
SAVE JS FILE:
function save() {
var dir = document.getElementById("file").innerHTML;
var data = document.getElementById("editPad").innerHTML;
window.location = "save.php?dir="+dir+"&data="+data;
}
It's not complete just cause I started today, but was working on some of the basics functions.
Upvotes: 1
Views: 339