Save HTML form data
You can submit forms to Val Town using the HTTP Val . You can place these forms on any page on the internet - or host the form directly on Val Town.
These examples show how to accept and store email addresses on Val Town. The email addresses are saved into a val, and you also get sent an email notification for each new signup.
Add a form to your website
Create a val that uses the HTTP Val
Add the form to your webpage
Copy your val’s Web endpoint URL using the menu (Endpoints > Copy web endpoint) and set it as the form’s action (this tells the form where to send its data when it’s submitted).
Below is a full HTML page example. If you are adding a form to an existing page
just copy and paste the
Host your form on Val Town
There are two ways to do this. You can write a val function that serves a webpage, and a separate val that accepts the form data - or you can write a single val that does both like the example below.
You can check the HTTP method using
req.method and change how your val