O'Reilly logo

Go Web Development Cookbook by Arpit Aggarwal

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How to do it…

In this recipe, we will create a simple HTML form that has two input fields and a button to submit the form. Perform the following steps:

  1. Create login-form.html inside the templates directory, as follows:
$ mkdir templates && cd templates && touch login-form.html
  1. Copy the following content to login-form.html:
<html>  <head>    <title>First Form</title>  </head>  <body>    <h1>Login</h1>    <form method="post" action="/login">      <label for="username">Username</label>      <input type="text" id="username" name="username">      <label for="password">Password</label>      <input type="password" id="password" name="password">      <button type="submit">Login</button>    </form>  </body></html>

The preceding template has two textboxes—username and password—along with ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required