Вот мой серверный скрипт
Код | <?php $newsname = $_POST['newsname']; $newstext = $_POST['elm1'];
$dblocation = "localhost"; $dbuser = "root"; $dbpasswd = ""; $dbname="robot";
$dbcnx = @mysql_connect($dblocation,$dbuser,$dbpasswd); if (!$dbcnx) { echo"<p>not connect!!!.</p>"; exit(); }
if (!@mysql_select_db($dbname, $dbcnx)) { echo "<p>Not connect!!!.</p>" ; exit(); } mysql_query("set names utf8"); $sql = "insert into tbl_news (N_name, N_text, disp) values('".$newsname."', '".$newstext."', '".$_POST['disp']."')"; $result = mysql_query($sql);
?>
|
а это клиентский
Код | <?php header('Content-Type: text/html; charset=windows-1251'); ?> <script type="text/javascript" > tinyMCE.init({ // General options mode : "textareas", theme : "advanced", plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,inlinepopups",
// Theme options theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect", theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor", theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen", theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak", theme_advanced_toolbar_location : "top", theme_advanced_toolbar_align : "left", theme_advanced_statusbar_location : "bottom", theme_advanced_resizing : true,
// Example word content CSS (should be your site CSS) this one removes paragraph margins content_css : "css/word.css",
// Drop lists for link/image/media/template dialogs template_external_list_url : "js/template_list.js", external_link_list_url : "js/link_list.js", external_image_list_url : "js/image_list.js", media_external_list_url : "js/media_list.js"
// Replace values for the template plugin /* template_replace_values : { username : "Some User", staffid : "991234" }*/ }); </script>
<script type="text/javascript"> $(document).ready(function(){
$('#newsForm').ajaxForm({ beforeSubmit : function(){
$('#loading').show();
}, success : function(response){ $('#loading').hide(); $('#newsForm').clearForm(); } });
});
jQuery.ajax(contentType(application/x-www-form-urlencoded)); </script>
<form id="newsForm" method="post" action="mods/news/savenews.php"> <input type="text" name="newsname"/>
<!-- Gets replaced with TinyMCE, remember HTML in a textarea should be encoded --> <textarea id="elm1" name="elm1" rows="15" cols="80" style="width: 80%"> <script type="text/javascript"> text=tinyMCE.get('elm1').getContent(); </script> </textarea>
<br /> <input type="hidden" name="disp" value="1" /> <input type="hidden" value='text' /> <input type="submit" name="save" value="Submit" /> <input type="reset" name="reset" value="Reset" /> </form>
|
|