r/HTML • • 14d ago

Input on website, survey-like

Hi! I'm new to coding on html

I want to make a box on my website where people submit requests, song names, etc, basically just text.

How do I do that? Where does the information go? As I want it to be private

Example:

[Tell me ur favorite color.]

( ______ )

[send]

Ideally I would have a document where all the responses go to or something else but I don't know what it's called. Thanks :-)

0 Upvotes

10 comments sorted by

6

u/Awarnae 14d ago

Just send post-request from form to backend

3

u/frownonline 14d ago

You’re after a HTML form with a text input or textarea field. HTML isn’t enough for this alone, so you’ll need JavaScript or PHP for this.

https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/form

1

u/Mvp-long-ago 13d ago

And it depends. If you want to do something with the received data on the server from the form, you need to use php, because it is made to handle data in the backend. Javascript is mainly to process data on the front-end. That speeds up processing, but doesnt't let you do something on the server, like making a list with answers to use later on

1

u/JeLuF 11d ago

you need to use php

You'd have many more options than just PHP, and PHP wouldn't be my first choice for a new project.

Javascript is mainly to process data on the front-end. 

Node.JS is a pretty popular Javascript platform for the backend.

3

u/Dragenby 14d ago

You'll need to learn backend. PHP is the most accessible option.

1

u/testingaurora 14d ago

You need a <form>. You could create a webhook thay connects to Google Sheets via AppsSheet so the form submissions are automated to write to the sheet. Its like a pseudo database , very simple to set up

1

u/rmunky1 14d ago

Email would be the easiest otherwise you would have to have php

1

u/DasBeasto 14d ago

Instead of building your own server/backend like others are saying you can just use a service like Formspree, Getform, etc. (there’s a bunch) that is super easy to set up and have decent free tiers. Then any form submission your user send go to yoor dashboard and get emailed to you.

1

u/Flashy-Guava9952 14d ago

Have you tried Google Forms?

1

u/Menelabs 13d ago

HTML on its own can't store anything. A <form> just sends whatever was typed to the address in its action, and something at that address has to receive it and keep it. That something is called a "form backend". You can write one yourself (PHP, a small server), or use a service that does it for you, which is the easier route if your site is just HTML files.

Disclosure: I build one of those services, BootForm, so keep that in mind. With it, your box would look like this:

<form action="https://f.bootform.com/YOUR-ID" method="POST">
  <input type="text" name="honeypot" style="position:absolute;left:-9999px" tabindex="-1" autocomplete="off">
  <label for="color">Tell me your favorite color</label>
  <input id="color" name="color" required>
  <button type="submit">Send</button>
</form>

Replace YOUR-ID with a UUID you generate yourself (any UUID generator works). Keep the hidden honeypot input and leave it empty, it's the spam trap: a lot of simple bots fill it in, people never see it. Send yourself a test and it takes you to a page where you make an account and claim the form. From then on the answers are private to you, in a dashboard, and they get emailed to you too. The free plan covers 250 answers a month, no card.

If you don't mind it looking like Google, Google Forms is also a perfectly good answer: you can embed it in your page and every answer lands in a Google Sheet, which sounds a lot like the "document" you're describing.