php/mysql character issues
Posted on 2005-03-03
var htmlCode = iView.document.body.innerHTML; //assigns data in iframe to variable htmlCode
//document.myform.mytext.value = htmlCode;
document.myform.newsPost.value = htmlCode; //assigns hidden form field the htmlCode data
so now that the data is in the form field it gets posted and the script adds the data to the database. Ok, sounds good no problem ehh? I found i needed to use the addslashes() function before the data went into the database else it wouldn't store anything with ' (apostrophes)...so i fixed that issue. The problem now is not putting the data into the database, it's getting the data BACK into the IFRAME. here is the code i use to get the data back into the iframe from the database:
$n = $_GET['m']; //m = the story id in the dbase
$qry = mysql_query("SELECT * FROM paths where id = '$n'");
$ourstory = $query['webstory'];
var viewMode = 1; // WYSIWYG
iView.document.designMode = 'On';
iView.document.write(webstory2); //this successfully writes the data into the iframe for editing.
<body onLoad="Init()"> //calls the init() function on page load
thanks in advance.