MPV was on track to get you where you needed to go. Sharing this for posterity.
Put a hidden input into your form and also attach a JavaScript function to your submit button:
<form method="POST">
<input type="submit" onclick="setupFormPost()" />
<div id="container" style="width:800px;height:600px;border:1px solid grey"></div>
<input hidden name="code" id="code" />
</form>
Here is a small snippet of JavaScript that sets up an editor and also the "setupFormPost()" function that will move the value from the Monaco editor into the hidden field that is then easily posted.
<script>
var editor = monaco.editor.create(document.getElementById('container'), {
language: 'javascript'
});
function setupFormPost() {
var value = window.editor.getValue()
$("#code").val(value);
}
</script>