html code structure is as it follows a simple form
<form action="index.php" method="post" enctype="multipart/form-data">
<div contenteditable="true" id="post"></div>
<input type="text" name="postHiddenField" id="postHidden" hidden>
<button type="submit" name="submitPost">Post</button>
</form>
beneath the form the javascript is a simple atribute
var content = document.getElementById('post').innerHTML;
document.getElementById('postHidden').value = content;
on top of the form is the form being proccessed
<?php
if (isset($_POST['submitPost'])) {
if (!empty($_POST['postHiddenField'])) {
echo $_POST['postHiddenField'];
} else {
echo "field is empty";
}
}
?>
result i get on submission is field is empty how to proper get content's editable content and pass it to the hidden field as value?