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


Like I said in the title, I am trying to get my results from the form below:

<!DOCTYPE html>
  <link rel="stylesheet" href="style.css">
/* Struggling with this part */
<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>Apex Legends</option>
      <option>Call of Duty: Warzone</option>
      <option>Rocket League</option>
  <div class="form-control">
    <label>More games you may play
        <small>(Check all that apply)</small>
        <input type="checkbox"
        <input type="checkbox"
            name="inp">GTA 5</input></label>
        <input type="checkbox"
            name="inp">Call Of Duty</input></label>
        <input type="checkbox"
        <input type="checkbox"
        <input type="checkbox"
            name="inp">League of Legends</input></label>
        <input type="checkbox"
            name="inp">Rocket League</input></label>
        <input type="checkbox"
            name="inp">Elden Ring</input></label>
        <input type="checkbox"
        <input type="checkbox"
  <button type="submit" value="button" class="neon-button">

It is a basic form I am working on learning web dev, however I am stuck here. If someone wouldnt mind helping me take the results and add it to a text file in the same directory as the HTML and CSS it would be greatly appriciated.


In your <script> tag, you’ll either need to add an action for the form or manually get the value of each input element when the select button is clicked. However, in order to write the result to a text file, you’ll need something on the server-side. Client-side JS does not provide the utilities to write to server-side files, for this would be impossible to implement.

Answered By – kuizeo

Answer Checked By – Gilberto Lyons (AngularFixing Admin)

Leave a Reply

Your email address will not be published.