I'm using the HTML tag to display html/js code retrieved from my mysql db.
The user can edit this code (xmp contentEditable='true') and save it back to the mysql db.
I'm able to retrieve the data (html/js code) from mysql and display it between xmp tags (I have this in a form), but once I submit it, it doesn't get passed to the other php page.
This is my form, with the xmp tag populated using php (mysql data):
<form action="save-script.php" method="POST" onsubmit="document.getElementById('hidden_data').value = document.getElementById('html_output').innerHTML;">
<?php
echo "<xmp id='html_output' contentEditable='false'>" . $formcodelong. "</xmp>";
echo "<input name='formid' type='hidden' value='" . $formid. "'/>";
?>
<input id="hidden_data" name="data" type="hidden"/>
<input type="submit" Value="Enter" id="submitthis">
</form>
This (save-script.php) is where i'm trying to read what's been posted
// Get form values
$data = $_POST['data'];
echo "<br />data : " . $data ;
I was hoping to do the same thing I read here, except with xmp instead of div: How can I submit div data to MySQL
There is nothing wrong on PHP side. Could you please look at your rendered html form by using firebug? I think there is something about your generated form html. If any errors, fix them and it should work