While making use of a sample for addContent (located at http://www.randomsnippets.com - specific page here ) I stumbled into a problem that I hope someone can help on. This may not be the best/only way to skin this cat, but we have a PHP/MySQL page that has to be modified to ADD rows for data entry when needed. I have abandoned the traditional DOM object methods of adding a single row, since in this case the addition would be a whole block of rows. I don't think I'm smart enough to do that...
Anyway, an idea hit me to make use of our MySQL dB and store the rows in there, and retrieve them using their method.
<script language="javascript">
function addContent(divName, content){
document.getElementById(divName).innerHTML = content;
}
</script>
<form name="myForm">
Content to be added:
<textarea name="myContent"><?php echo $_value?></textarea>
<input type="button" value="Add content" onClick="addContent('myDiv', document.myForm.myContent.value); setCookie('content', document.myForm.myContent.value, 7);">
</form>
<br><br>
Your content will be added dynamically below:
<div id="myDiv"></div>
Skipping an ultimate requirement that the content of the addition be invisible and inaccessible, I tried the above out. It works, but the variable ($_value) has form elements in it, including <TEXTAREA></TEXTAREA>, and the close of that tag interrupts the value and throws the remaining code to the page, not awaiting insertion by the Submit Button. Example: http://www.facey.com/insert_content1.php
The Submit button successfully produces the part that stayed inside, but you see my problem.
IS THERE A WAY to use this javascript addContent function,
incorporate the utility of an ADD button
but avoid using the packaging of FORMS?
Thanks for any help!
Bryan
<EMAIL SNIPPED>
p.s. The PHP is transparent. Direct inclusion of the HTML contained in the variable as the value of TEXTAREA produces the same result.