Wrox Programmer Forums
|
ASP Forms As of Oct 5, 2005, this forum is now locked. Please use "Classic ASP beginner" at http://p2p.wrox.com/forum.asp?FORUM_ID=54 or "Classic ASP Professional" http://p2p.wrox.com/forum.asp?FORUM_ID=56 instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Forms section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 19th, 2004, 11:39 AM
Authorized User
 
Join Date: Apr 2004
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default add querysting using get method

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:
  http://www.mywebsite.com/page2.asp?v...g&v2=something

  But i want that:
  http://www.mywebsite.com/page2.asp?i...g&v2=something

  How can do that?

  Thanks
  Burhan


 
Old September 19th, 2004, 11:52 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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:
Code:
<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?
 
Old September 20th, 2004, 12:28 AM
Friend of Wrox
 
Join Date: Sep 2004
Posts: 104
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to sureshbabu Send a message via Yahoo to sureshbabu
Default

Hi ,
     i think you are keeping one unnecessary place at the query string named id .remove that space. It works fine
Thanks
suresh
 
Old September 25th, 2004, 07:59 AM
Authorized User
 
Join Date: Apr 2004
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks @ Imar it now works fine

sureshbabu i did not find any unneccesry space.

From Burhan






Similar Threads
Thread Thread Starter Forum Replies Last Post
Can’t add method to class in C#? arbab BOOK: Beginning C# 2005 Databases 0 September 29th, 2008 07:35 AM
How to add " " inside a method({ }) and XSLT 7 July 14th, 2008 03:27 AM
add method to control travlos Access VBA 2 August 4th, 2007 02:09 AM
error on MXSML2 schema add method sasidhar79 Classic ASP XML 0 May 30th, 2007 01:10 PM
Add Push button or Check Box in outlook add-ins capdevs VS.NET 2002/2003 0 January 7th, 2006 08:51 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.