anonymous No title
No License PHP
2021年05月26日
Copy Clone
<!DOCTYPE html>
<html lang="ja" >
  <head>
    <meta charset="UTF-8">
    <title>簡易掲示板</title>
  </head>
  <body>
  <h1>簡易掲示板</h1>
    <form method="post" action="" >
      <p>名前</p>
      <input type="text" name="user_name" required>
      <p>コメント</p>
      <textarea name="comment" rows="4" cols="40"></textarea><br>
      <input type="submit" value="送信">
    </form>
    <?php
   	error_reporting(0);
    	$name=$_POST["user_name"];
   	$comment=$_POST["comment"];
   	$today = date("Y-m-d H:i:s");
   	$filename="kadai_2_2.txt";
   	$num=count(file($filename));
	$num++;
   	fwrite($fp, $num . '<>' . $name . '<>' . $comment . '<>' . $date . "\n");
     	fclose($fp);
    ?>
  </body>
</html>
<!DOCTYPE html>
<html lang="ja" >
  <head>
    <meta charset="UTF-8">
    <title>簡易掲示板</title>
  </head>
  <body>
  <h1>簡易掲示板</h1>
    <form method="post" action="" >
      <p>名前</p>
      <input type="text" name="user_name" required>
      <p>コメント</p>
      <textarea name="comment" rows="4" cols="40"></textarea><br>
      <input type="submit" value="送信">
    </form>
    <?php
   	error_reporting(0);
    	$name=$_POST["user_name"];
   	$comment=$_POST["comment"];
   	$today = date("Y-m-d H:i:s");
   	$filename="kadai_2_2.txt";
   	$num=count(file($filename));
	$num++;
   	fwrite($fp, $num . '<>' . $name . '<>' . $comment . '<>' . $date . "\n");
     	fclose($fp);
    ?>
  </body>
</html>
No one still commented. Please first comment.
Output