Can somebody explain HTML forms to me like I'm an actual retard?
Not the styling of the form , or the validation (although that has my head twisted too)
What's this action/method carry on ?
Where does the form data go?
How does it get there?
#AskNostr
```
Okay, so action is often just the URL that you want to send the data in your form to.
Method is about how you want that data to be sent. You have 2 options:
1. POST: This sends the data to the destination in a way that the server can read and process it silently. You also have the luxury of being able to send unlimited information, so you can include file uploads too.
2. GET: This appends your data onto the URL and just visits it:
/destination?name=Bob&age=30
There is a limit to the size of data that can be sent this way, but it has some benefits:
1. the user can see everything that is being sent by looking at the browser URL
2. If you're building a web app with no backend and database, then you might be handling everything in browser with some JavaScript. If the data is in the URL, then the web app can read this data and use it. It can't read POST data.
Typically, you send via POST if:
1. You are sending a file
2. You are sending data to be actioned, like a command with details (send an email with contents=.....)
3. You want the data to be stored in the database
Typically you send a GET if:
1. You are just querying (search)
2. You are applying a filter (ages=20-30)
3. You are indicating an ID (/profile?id=10
3. You are building a web app with a dumb server so the webpage needs to read the data.
The inputs in the form indicate what data is put into the POST or GET data:
Please Login to reply.
No replies yet.