Ciao a tutti, ho un problema: devo passare i dati di un text-editor Javascript (cioè praticamente una textarea creata da JS) all'interno di un <form> ad un'altra pagina (va bene anche un refresh della stessa) in modo che php possa registrare le modifiche in un db (o per qualsiasi altro uso) facendo poi vedere nell'editor il testo aggiornato.
Il problema nasce dal fatto che Javascript invia il testo vecchio, pur facendomi vedere in diretta le modifiche che apporto al testo.
So pochissimo di JS, qualcuno può aiutarmi pls? il codice è questo:
<?php
if (isset($_GET['rte1'])) { $testo_news=$_GET['rte1']; }
else {
$testo_news=$row_news['testo']; }
$editor=<<<EDITOR
<script language="JavaScript" type="text/javascript" src="http://localhost/ciai.it/admin/utils/text_editor/richtext_compressed.js"></script>
<div align="center">
<form name="RTEDemo" action="news2.php" method="GET">
<script language="JavaScript" type="text/javascript">
<!--
function submitForm() {
updateRTE('rte1');
alert("rte1 = " + document.RTEDemo.rte1.value);
//change the following line to true to submit form
return true;
}
//Usage: initRTE(imagesPath, includesPath, cssFile)
initRTE("http://localhost/ciai.it/admin/utils/text_editor/images/", "", "");
//-->
</script>
<noscript>
Javascript must be enabled to use this form.</p></noscript>
<script language="JavaScript" type="text/javascript">
<!--
//Usage: writeRichText(fieldname, html, width, height, buttons, readOnly)
writeRichText('rte1', '$testo_news', 400, 200, true, false);
//-->
function onClick() {
document.getElementById("RTEDemo").action = "news2.php?rte1="+rte1;
document.getElementById("RTEDemo").submit();
}
</script>
<input name="edit" type="submit" value="Salva le modifiche" onclick="java-script: onClick();">
<input type="hidden" name="action" value="edit">
<input type="hidden" name="news_id" value="$news_id">
</form>
</div>
EDITOR;
?>
Grazie mille!!!