Here is a javascript / ajax example on the PAGE A page:
var commReq = getXmlHttpRequestObject();
function AddComment(Comment){
if (commReq.readyState == 4 || commReq.readyState == 0){
commReq.open("GET", '/receiveComment.php?com='+Comment+'&' + Math.random(), true);
commReq.onreadystatechange = handleComment;
commReq.send(null);
}
}
Now the php page that receives the comment (receiveComment.php) PAGE B:
$Comment = mysql_real_escape_string(preg_replace("/[^A-Za-z0-9_,.!@:'\"\/\n ]/","", $_GET['com']));
mysql_query("INSERT INTO Comments (Comment,Date) VALUES ('$Comment','$Date')");
Obviously, these are just selective abbreviations, but from 2 pages. Page B has not been visible since its use via ajax, which I use to store the comment. But I want to be able to store line breaks that the user can insert in the textarea field. Any help or recommendations would be greatly appreciated!
SReca source
share