Jacob Paris
← Back to all content

Submit a form with basic HTML

When a user submits a form, the browser will send a request to the current route. By default, this is a GET request. The request type can be set using either method="GET" or method="POST".

<form method="POST">
<input type="text" name="username" />
<input type="password" name="password" />
<button type="submit">Submit</button>

You can change the route for the submission with the action attribute. This is useful for submitting forms to other pages.

<form action="/"></form>
<form action="/app/products/new"></form>

This can be used to make a log out button

<form method="POST" action="/logout">
<button type="submit">Log out</button>

This form will submit a GET request to Google Search.

<form action="https://google.com/search">
<button type="submit">Search</button>
Professional headshot

Hi, I'm Jacob

Hey there! I'm a developer, designer, and digital nomad with a background in lean manufacturing.

About once per month, I send an email with new guides, new blog posts, and sneak peeks of what's coming next.

Everyone who subscribes gets access to the source code for this website and every example project for all my tutorials.

Stay up to date with everything I'm working on by entering your email below.

Unsubscribe at any time.