无法将 HTML 表单结果提取到文本文件。我已经尝试了 2 个小时,但没有任何效果

Having trouble extracting HTML form results to a text file. I have been trying for 2 hours but nothing has worked

正如我在标题中所说,我正在尝试从以下表格中获取结果:

<!DOCTYPE html>
<html>
<head>
  <link rel="stylesheet" href="style.css">
  <script>
/* Struggling with this part */
  </script>
</head>
<body>
<h1 style="color:#e6e8e8">Video Game Form</h1>
<form id="form" class="form">
  <div class = "form-control">
    <label>All Time Favorite Game:</label>
    <input name="allgame" id="allgame" type="text" placeholder="Enter your favorite game">
    <label>Favorite Free Game:</label>
    <select name="freegame" id ="freegame">
      <option>Select your favorite game</option>
      <option>Fortnite</option>
      <option>Apex Legends</option>
      <option>Call of Duty: Warzone</option>
      <option>Valorant</option>
      <option>Rocket League</option>
    </select>
  </div>
  <div class="form-control">
    <label>More games you may play
        <small>(Check all that apply)</small>
    </label>
    <label>
        <input type="checkbox"
            name="inp">Minecraft</input></label>
    <label>
        <input type="checkbox"
            name="inp">GTA 5</input></label>
    <label>
        <input type="checkbox"
            name="inp">Call Of Duty</input></label>
    <label>
        <input type="checkbox"
            name="inp">Fortnite</input></label>
    <label>
        <input type="checkbox"
            name="inp">Valorant</input></label>
    <label>
        <input type="checkbox"
            name="inp">League of Legends</input></label>
    <label>
        <input type="checkbox"
            name="inp">Rocket League</input></label>
    <label>
        <input type="checkbox"
            name="inp">Elden Ring</input></label>
    <label>
        <input type="checkbox"
            name="inp">Zelda</input></label>
    <label>
        <input type="checkbox"
            name="inp">Other...</input></label>
        </div>
  <button type="submit" value="button" class="neon-button">
    Submit
  </button>
</form>
</body>
</html>

这是我正在学习网络开发的基本形式,但我被困在这里。如果有人不介意帮助我获取结果并将其添加到与 HTML 和 CSS 相同目录中的文本文件中,我们将不胜感激。

在您的 <script> 标签中,您需要 add an action for the form or manually get the value of each input element when the select button is clicked。但是,为了将结果写入文本文件,您需要 server-side 上的一些内容。 Client-side JS 不提供写入 server-side 文件的实用程序,因为这是不可能实现的。