Commit a06c0b5c authored by 君塚 悠's avatar 君塚 悠

プログラム作成(guest_input,guest_write.php:ゲストブック入力フォーム)

parent a5e14659
<html>
<head>
<title>ゲストブック</title>
</head>
<body>
<!-- ccc...灰色 -->
<h1 style="background:#cccccc">ゲストブック(書き込み)</h1>
<!-- 入力フォーム。<form~で作成-->
<form method="POST" action="guest_write.php">
お名前:
<input type="text" name="name" size="20" maxlength="30" /><br />
メッセージ:
<input type ="text"name="message" size="70" maxlength="255" /> <br />
<input type="submit" value="送信" />
</form>
</body>
</html>
\ No newline at end of file
<?php
$file=fopen("guet.dat","a");
flock($file,LOCK_EX);//ファイルをロック(他ユーザが編集できなくなる
//$line変数に書き込む文字列を連結していく。\tはタブ
$line =date("Y年 m月 d日 H:i:s")."\t";
$line.=$_POST['name']."\t";
$line.=$_POST['message']."\t";
fputs($file,$line."\n");
flock($file,LUCK_UN);//ファイルのロックを解除
fclose($file);
header("Location: guest_input.php");
?>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment