Hjælp til Cross-Browser Rich Text Editor
Jeg kan ikke få ændringer i teksten i rte1 med over i databasen. Hvis jeg submitter formen og printer alt der bliver sendt med POST, så er det ikke rettelserne den skriver.Er der nogen der kan sige hvorfor?
Koden
<script language="JavaScript" type="text/javascript">
<!--
function submitForm() {
//make sure hidden and iframe values are in sync before submitting form
//to sync only 1 rte, use updateRTE(rte)
//to sync all rtes, use updateRTEs
updateRTE('rte1');
//updateRTEs();
//change the following line to true to submit form
return true;
}
//Usage: initRTE(imagesPath, includesPath, cssFile, genXHTML)
initRTE("images/", "", "", true);
//-->
</script>
<noscript><p><b>Javascript must be enabled to use this form.</b></p></noscript>
<script language="JavaScript" type="text/javascript">
<!--
<?php
//format content for preloading
if (!(isset($_POST["rte1"]))) {
$content = "Fyld din tekst i dette felt.";
$content = rteSafe($content);
} else {
//retrieve posted value
$content = rteSafe($_POST["rte1"]);
}
?>//Usage: writeRichText(fieldname, html, width, height, buttons, readOnly)
writeRichText('rte1', '<?=$content;?>', 500, 200, true, false);
//-->
</script>
</td></tr>
<tr><td>Billede: </td><td><INPUT TYPE="text" VALUE="" NAME="picture" class="form" style="width:280px;"> <a href="choosepic.php" onclick="NewWindow(this.href,'mywin','500','450','no','center');return false" onfocus="this.blur()"><IMG SRC="admin_gfx/picture.gif" BORDER="0" WIDTH="16" HEIGHT="16" ALIGN="top" ALT=""ALT=""></a></td></tr>
<tr><td></td><td><BR>
<p><input type="submit" name="submit" value="Opret afsnit" class=form></p>
</td></tr></table>
<?php
function rteSafe($strText) {
//returns safe code for preloading in the RTE
$tmpString = $strText;
//convert all types of single quotes
$tmpString = str_replace(chr(145), chr(39), $tmpString);
$tmpString = str_replace(chr(146), chr(39), $tmpString);
$tmpString = str_replace("'", "'", $tmpString);
//convert all types of double quotes
$tmpString = str_replace(chr(147), chr(34), $tmpString);
$tmpString = str_replace(chr(148), chr(34), $tmpString);
// $tmpString = str_replace("\"", "\"", $tmpString);
//replace carriage returns & line feeds
$tmpString = str_replace(chr(10), " ", $tmpString);
$tmpString = str_replace(chr(13), " ", $tmpString);
return $tmpString;
}
?>
