anonymous No title
No License PHP
2020年10月22日
Copy
<!DOCTYPE html>
<html lang="ja">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>課題1-6</title>
</head>
<body>
<form action = "kadai_1-6.php" method = "post">
  <input type = "text" name = "comment"><br>
  <input type = "submit" value = "送信">
  </form>

<?php
  if(isset($_POST["comment"])) {
    $comment = $_POST["comment"];
    
    $fp = fopen("kadai_1-6.txt","a");
    fwrite($fp,$comment.PHP_EOL);
    fclose($fp);
  }
?>
</body>
</html>
<!DOCTYPE html>
<html lang="ja">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>課題1-6</title>
</head>
<body>
<form action = "kadai_1-6.php" method = "post">
  <input type = "text" name = "comment"><br>
  <input type = "submit" value = "送信">
  </form>

<?php
  if(isset($_POST["comment"])) {
    $comment = $_POST["comment"];
    
    $fp = fopen("kadai_1-6.txt","a");
    fwrite($fp,$comment.PHP_EOL);
    fclose($fp);
  }
?>
</body>
</html>

Output

Run
年末年始は機械学習・深層学習を勉強しませんか?
No one still commented. Please first comment.
年末年始は機械学習・深層学習を勉強しませんか?
広告
未経験から最短でエンジニアへの転職を目指すなら