Form data not added to query string

Viewed 20

Form data is not being added to the URL as query string, i.e., something like this 127.0.0.1:8080/room?first=king&last=henry.

The files index.html and room.html are the only files in the folder. I serve up the folder with $ npx serve -l 8080 and it runs on 127.0.0.1:8080.

The contents of index.html

<form action="/room.html" method="GET">
  <label for="first">first:</label>
  <input type="text" name="firt">
  <label for="last">last:</label>
  <input type="text" name="last">
  <button>submit</button>
</form>

But when I hit submit, it does not add the input values as a query string to the URL.

Interestingly enough when I simply omit the action="/room.html", it does add it.

EDIT: After looking further into it, in the network panel it logs room.html?first=king&last=Henry and right after logs room. The former has header Status Code: 301 Moved Permanently.

Any insight is great. Thanks!

0 Answers
Related