戻る      schedule_record.php           

《PHP言語 /schedule_record.php》

<?php
function showOpt($start,$end){
for($i=$start;$i<=$end;$i++){
print("<option value='".$i."'>".$i."</option>");
}
}
?>
<html>
<head>
<title>簡易スケジュール帳</title>
</head>
<body>
<h1 style="background:#cccccc">簡易スケジュール帳</h1>
<form method="POST" action="schedule_record2.php">
<table border="0">
<tr>
<th align="right">予定名:</th>
<td><input type="text" name="title" size="50" maxlength="255" /></td>
</tr>
<tr>
<th align="right">日付:</th>
<td>
<select name="s_date_year"><?php showOpt(2005,2010); ?></select>年
<select name="s_date_month"><?php showOpt(1,12); ?></select>月
<select name="s_date_day"><?php showOpt(1,31); ?></select>日
</td>
</tr>
<tr>
<th align="right">開始時間:</th>
<td>
<select name="s_time_hour"><?php showOpt(0,23); ?></select>時
<select name="s_time_minute"><?php showOpt(0,59); ?></select>分
</td>
</tr>
<tr>
<th align="right">備考:</th>
<td><input type="text" name="memo" size="70" maxlength="255" /></td>
</tr>
<tr>
<td rowspan="2">
<input type="submit" value="登録" />
<input type="reset" value="クリア" />
</td>
</tr>
</table>
</form>
</body>
</html>

《PHP言語 /schedule_record2.php》

<?php
$db=sqlite_open("schedule.sqlite",0666,$err);
$s_date=$_POST['s_date_year']."/".$_POST['s_date_month']."/".$_POST['s_date_day'];
$s_time=$_POST['s_time_hour'].":".$_POST['s_time_minute'];
sqlite_query($db,"INSERT INTO schedule(title,s_date,s_time,memo) VALUES('".sqlite_escape_string($_POST['title'])."','".sqlite_escape_string($s_date)."','".sqlite_escape_string($s_time)."','".sqlite_escape_string($_POST['memo'])."')");
sqlite_close($db);
header("Location: schedule_record.php");
?>

《PHP言語 /schedule_delete.php》

<?php
$db=sqlite_open("schedule.sqlite",0666,$err);
sqlite_query($db,"DELETE FROM schedule WHERE sid='".sqlite_escape_string($_GET['sid'])."'");
sqlite_close($db);
header("Location: schedule_read.php");
?>


《PHP言語 /schedule.sqlite》