PHP和数据库做日历 高手给点帮助呗 简单点就行 求代码
追问:数据库呢?这么不全面????专业点好不好。。。
追问:数据库呢?这么不全面????专业点好不好。。。
答案:<?php
if(isset($_GET['add_flag']) ){
require_once './Setting.php';
try {
$dbm = new DBManager($dsn, $user, $passwd);
$db = $dbm->getDB();
$stt = $db->prepare('INSERT INTO diary(date1,title,content,weather,feeling) VALUES(:date1,:title,:content,:weather,:feeling)');
$stt->bindValue(':date1', $_GET['date1']);
$stt->bindValue(':title', $_GET['title']);
$stt->bindValue(':content', $_GET['content']);
$stt->bindValue(':weather', $_GET['weather']);
$stt->bindValue(':mood', $_GET['mood']);
$stt->execute();
} catch(PDOException $e){
die("エラー: {$e}");
}
$db = null;
$dbm = null;
header('Location: ./main.php');
}
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>ユーザ管理システム - ユーザの追加</title>
<script src="./sd.js" type="text/javascript"></script>
</head><body>
<div id="header">
<h1>ユーザ管理システム</h1>
<h2>ユーザの追加</h2>
<?php
?>
</div>
<form action="./add_user.php" method="get">
<input type="hidden" size="5" name="id"><br>
<table>
<tr>
<td>date:</td>
<td><input type="TextBox" size="20" name="date1" ID="TextBox1" onfocus="calendar()" runat="server"></td>
</tr>
<tr>
<td>title:</td>
<td><input type="text" size="20" name="title"></td>
</tr>
<tr>
<td>content:</td>
<td><textarea name="content" cols = "45" rows = "5"></textarea></td>
</tr>
<tr>
<td>weather:</td>
<td><input type="radio" name="weather" value="阴" id="weather1" checked>
<label for="weather1" style="background-image: rainy.jpg)">rainy</label>
<input type="radio" name="weather" value="晴" id="weather2">
<label for="weather2" style="background-image: sunny.jpg)">sunny</label></td>
</tr>
<tr>
<td>mood:</td>
<td><input type="radio" name="feeling" value="happy" id="mood1" checked style="background-image: happy.jpg)">
<label for="mood1">happy</label>
<input type="radio" name="feeling" value="伤心" id="mood2" style="background-image: sad.jpg)" >
<label for="mood2">sad</label></td>
</tr>
<br>
</table>
<input type="hidden" name="add_flag" value="true">
<input type="submit" value="Add">
</form>
<p><a href=> </body>
</html>什么意思,你要实现什么功能
上一个:数据库(php)代码语法错误问题,请教高手!
下一个:C++ 如何模仿php的对象序列化serialize()及unserialize()?有没有现成的开源代码?