日期:2014-05-16 浏览次数:20604 次
function click_submit(){
var entry_cat=document.getElementById('addentry_cat').value;
var entry_subject=document.getElementById('addentry_subject').value;
var entry_content=GetTinyMceContent('ajaxfilemanager');
var url="addentry_1.php";
var poststr="cat="+entry_cat+"&subject="+entry_subject+"&content="+entry_content+"&sid="+Math.random();
post_ajax(url,poststr);
}
<?php
require("config.php");
$db=mysql_connect($dbhost,$dbuser,$dbpassword) or die("连接服务器失败!".mysql_error());
mysql_query("set names 'utf8'");
mysql_query("set character_set_client=utf8");
mysql_query("set character_set_results=utf8");
mysql_select_db($dbdatabase,$db);
$num_cat=$_POST["cat"];
$subject=$_POST["subject"];
$content=$_POST["content"];
$sql="INSERT INTO entries(cat_id,dateposted,subject,body)
VALUES(".$num_cat.",NOW(),'".$subject."','".$content."');";
mysql_query($sql)or die("插入失败!".mysql_error());
?>
var poststr = "cat=" + encodeURIComponent(entry_cat) + "&subject=" + encodeURIComponent(entry_subject) + "&content=" + encodeURIComponent(entry_content) + "&sid=" + Math.random();