I've been reading about the get method to submit form data.
So, the data from the form is appended to the action attribute's value of the form with ? as a separator.
What I fail to understand is, how I can correctly predict what the URL from a form submission will be.
I mean, lets say a form looks like this:
<form method="get" action="foobar.com/search">
User Name : <input type="text" name="uname"></input><br/>
Name : <input type="text" name="name"></input><br/>
<input type="submit" value="Submit"></input>
</form>
When the submit button is clicked, what is the generated URL?
It would be : foobar.com/search?[data encoded here]
But what protocol defines how it is encoded? The name might come before or after the user name.
Is it possible to write a script that would create a template URL for any form so that on replacing the corresponding %s with string data, it would create the correct URL?
THank you.
Note that query strings (name/value pairs) is sent in the URL of a GET request: /test/demo_form.asp?name1=value1&name2=value2. So in you case, it'll befoobar.com/search?uname=learner&name=350provided you enterlearner, and350in both fields respectively. And btw <input..></input>` is wrong markup.<input ... />is right. w3schools.com/tags/tag_input.asp