I need help with a related thing, I can't figure out how to pass the contents of the textarea into the script.
HTML:
Quote:
<form onsubmit="return false;"><strong>Comments:</strong><br />
<textarea rows="8" cols="30" style="width: 300px;" name="comments1" id="comments1"></textarea><br />
<input class="execute" type="submit" value="-->" name="execute" style="width: 300px; height: 30px;" onclick="post_comments(1,commentpost1); " />
|
Script:
Quote:
comments1 = document.getElementById("comments1");
commentpost1 = comments1.value;
function post_comments(id,text) {
var xmlhttp=false;
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
xmlhttp = false;
}
}
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
xmlhttp = new XMLHttpRequest();
}
post_str1 = "post_comments.php?record=";
post_str2 = "&comments=";
post_str = post_str1 + id + post_str2 + text;
xmlhttp.open("POST", post_str, true);
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4) {
var comments = document.getElementById("commentresult" + id);
comments.innerHTML = xmlhttp.responseText;
}
}
xmlhttp.send(null)
}
|
If I look at the contents of "post_str" it gives this so the comments field is not being passed to it:
post_comments.php?record=1&comments=
I'm sure there's something simple that I've overlooked.