I have a textarea and this javascript code It should work but dosen't is there something wrong? If so, what is it?
$('#text').load("http://hokuco.com/test/xe7/user.txt");
<form action="formcode.php" method="POST">
<textarea name='field2' placeholder='Code here' rows ="40" cols="40" id ="text"></textarea>
<br />
<input type="submit" name="submit" value="Save">
</form>
here is my php file if curious:
<?php
if(isset($_POST['field1']) && isset($_POST['field2'])) {
$data = $_POST['field1'] . '-' . $_POST['field2'] . "\n";
$ret = file_put_contents('code.txt', $data, FILE_APPEND | LOCK_EX);
if($ret === false) {
die('There was an error writing this file');
}
else {
echo "$ret bytes written to file";
}
}
else {
die('no post data to process');
}
?>