Kaz
Kaz

Reputation: 58578

Submit of simple HTML form with get method fails to construct URL with params

I have the following simple HTML:

<!doctype html public "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<title>Foo</title>
<body>
<form method="get" action="http://example.com">
  <input type="hidden" id="go">
  <div>
    <label for="userid">Userid:</label>
    <input type="text" id="userid">
  </div>
  <div>
    <input type="submit" value="Login">
  </div>
</form>
</body>
</html>

I validated this with W3C's online validator: all that it doesn't like is the hidden input element not being inside a div, p or some such.

When this page is loaded and the form is filled and submitted, it goes to the exact URL http://example.com, without any form parameters.

This happens whether I serve it as a static page from a server, output it out of a CGI script or access it as a local document using file://... on my desktop box. The behavior is the same using Firefox 43.0.4 on Windows 7, IE 11, or FF 42.0 on Ubuntu 12.

What is missing to make it produce something like http://example.com?go&userid=whatever?

Upvotes: 0

Views: 68

Answers (1)

Namal
Namal

Reputation: 2071

You haven't use name attributes in input fields.

Upvotes: 3

Related Questions