0

I was hoping someone could help me with submitting the answers to an HTML form as parameters of a link. So for example, lets say the form looked like this:

Name: _______
Question: ______

Then, when the user types their answers, and hits submit, I want the answers to be placed as parameters of the link so that if the user types:

Name: Joe Smith
Question: How do I win?

When the user then presses submit, a link that looks like the following would be submitted:

https://myurl.com/Submit.asp?Name=Joe%20Smith&Question=How%20do%20I%20win?
user1463925
  • 133
  • 2
  • 9

2 Answers2

1

Use Method type GET for your form

Shehzad Bilal
  • 2,535
  • 2
  • 18
  • 27
1

You need to use ,refer link

      method="GET"

more genrilize,

   <form action="url" method="GET">
    <input type="text" name="Name" value="" /> 
    <input type="text" name="Question" value="" /> 
    <input type="submit" /> 
   </form>

So when you submitthe form it will automatically build the querystring and append it to url.

go through submitting form here

Community
  • 1
  • 1
indiPy
  • 7,844
  • 3
  • 28
  • 39
  • Thanks! This really helped! One more quick question - when my link submits with the values in the input fields, it makes the spaces "+" rather than "%20". Any idea how to make the space encoding "%20"? I need that for my link to submit. – user1463925 Jun 25 '12 at 14:45
  • glad it helped you, and + is valid [encoding](http://en.wikipedia.org/wiki/URL_encoding), you get actual value by parsing it in your code – indiPy Jun 25 '12 at 15:06
  • Ah yes I see...the issue was with something else I was doing. Thanks! – user1463925 Jun 25 '12 at 18:21