When i try the following structure, it does't send id=value
<form action="some.php?id=value" method="get">
<input name="name1" value="value1">
<input type="submit">
</form>
I know that i can send id=value
in hidden field, but it's interesting, why it doesn't allow such structure?
It's because the "method=get" section of the form implies that the query values have to come from the form values.
The collection which contains "id=value" is overidden by the collection containing the form values.
This behaviour seems to be built into each browser, so I expect that it's part of the HTML specification.
Update
Ahah:
This has been asked before: submitting a GET form with query string params and hidden params disappear
To Quote:
As the specifications (RFC1866, page 46; HTML 4.x section 17.13.3) state:
If the method is "get" and the action is an HTTP URI, the user agent takes the value of action, appends a `?' to it, then appends the form data set, encoded using the "application/x-www-form-urlencoded" content type.
If your form method is POST
, then you will not see id
as part of the POSTed values, you can use the QueryString collection to access it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With