|
Subject:
|
add querysting using get method
|
|
Posted By:
|
BurhanKhan
|
Post Date:
|
9/19/2004 11:39:58 AM
|
Hi:
I have a form and want to send values using Get method.
Like this: <form method="get" action="page2.asp?id=1"> <input type="text" name="v1"> <input type="text" name="v2"> </form>
When form is submited, the " ?id=1 " is skiped from url like this: www.mywebsite.com/page2.asp?v1=something&v2=something
But i want that: www.mywebsite.com/page2.asp?id=1&v1=something&v2=something
How can do that?
Thanks Burhan
|
|
Reply By:
|
Imar
|
Reply Date:
|
9/19/2004 11:52:21 AM
|
Interesting. I never knew this was the behavior for the action attribute.
I hardly use GET-only forums, so I never noticed. When you change the method from GET to POST, the form fields are added to the Forms collection, while the id is still present in the QueryString.
For a strict GET solution, you could add a hidden field with the same name as the QueryString variable you're trying to pass. Something like this will work:<form method="get" action="page2.asp?id=1">
<input type="hidden" name="id" value="1">
<input type="text" name="v1">
<input type="text" name="v2">
<input type="submit" value="Submit Me">
</form>
When you now submit the form, all three form elements (id, v1 and v2) will be appended to the QueryString.
Cheers,
Imar --------------------------------------- Imar Spaanjaars Everyone is unique, except for me. While typing this post, I was listening to: Mind by System Of A Down (Track 9 from the album: System Of A Down) What's This?
|
|
Reply By:
|
sureshbabu
|
Reply Date:
|
9/20/2004 12:28:38 AM
|
Hi , i think you are keeping one unnecessary place at the query string named id .remove that space. It works fine Thanks suresh
|
|
Reply By:
|
BurhanKhan
|
Reply Date:
|
9/25/2004 7:59:02 AM
|
Thanks @ Imar it now works fine
sureshbabu i did not find any unneccesry space.
From Burhan
|