[991]PHP網站開發 進階應用技巧2
<?php
include "setup.php";
if($_POST['op']=="save"){
$sql = "insert into note (title,content,post_date) values('{$_POST['title']}','{$_POST['content']}',now())";
mysql_query($sql);
$sn=mysql_insert_id();
header("location:view.php?sn=$sn");
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title></title>
<link rel="stylesheet" type="text/css" href="dhtmlxSuite/dhtmlxEditor/codebase/skins/dhtmlxeditor_dhx_skyblue.css">
<script src="dhtmlxSuite/dhtmlxEditor/codebase/dhtmlxcommon.js"></script>
<script src="dhtmlxSuite/dhtmlxEditor/codebase/dhtmlxeditor.js"></script>
<style>
html, body {
width: 100%;
height: 100%;
margin: 0px;
padding: 0px;
overflow: hidden;
}
</style>
<script>
var editor;
function doOnLoad() {
editor = new dhtmlXEditor("editorObj");
editor.setIconsPath("dhtmlxSuite/dhtmlxEditor/codebase/imgs/");
editor.init();
}
</script>
</head>
<body onload="doOnLoad();">
<form action="input.php" method="post">
<input type="text" name="title" style="width: 100%;"><br />
<div id="editorObj" style="height:200px;border:1px solid gray;"></div>
<textarea id="content" name="content" style="display:none;"></textarea>
<input type="hidden" name="op" value="save">
<input type="submit" value="儲存">
</form>
</body>
</html>