Still having problems with querystring

Results 1 to 3 of 3

Thread: Still having problems with querystring

  1. #1
    Join Date
    Dec 1969

    Default Still having problems with querystring

    I am trying to pass the following string from one page to another: "test one" or "test 1". <BR><BR>Intially, I pass this text as part of the Query string portion of a URL and this works fine. For example:;%=Serv er.URLEncode ("""test one"" or ""test 1""")%&#062; passes the text exactly how I wanted to it look with the querystring portion of the URL appearing as: search_string=%22test+one%22+or+%22test+1%22 <BR><BR>However, when I try passing this text as a hidden input type from a form on the destination page (i.e. from, the Querystring ends up incorrect no matter what method I use. <BR><BR>For example, <BR>1) If from, I have the following ASP/HTML code: <BR>&#060;%search_string=Request.Querystring("sear ch_string")%&#062; <BR>&#060;input type="hidden" name="search_string" value="&#060;%=search_string%&#062;"&#062; <BR>When I submit the form, it seems as if the string gets cut off <BR>so that the quotes are removed and only a portion of the text is recognized. <BR>View source shows: <BR>&#060;input type="hidden" name="search_string" value=test one&#062; and URL shows: ?search_string=test+one <BR><BR>2) If I try to "Server.Urldecode" the search_String before submitting the form by replacing %22 with chr(34) and + with " ", <BR>and then Server.Urlencode the search_string upon submitting the form, <BR>View Source shows: &#060;input type="hidden" name="search_string" value=%22test+one%22+or+%22test+1%22&#062; <BR>And, the URL shows all these extra characters: <BR>&search_string=%2522test%2Bone%2522%2Bor%2B%25 22test%2B1%2522 <BR><BR>3) Without the Server.URLEncode, the string looks fine when I do a view source, but the URL performs as in situation one, cutting off the string and removing all quotes. <BR><BR>4) The only way that has worked for me so far is explicitly setting search_string to ""test one" or "test 1"", which I would like to avoid. <BR><BR>Is there any way any way to pick up this type of text enclosed in quotes from a URL and pass it back to the same page in a form??? <BR><BR>Any help would be most appreciated. <BR><BR>Regards, <BR>Mitchell

  2. #2
    Join Date
    Dec 1969

    Default Post the full code from

    your form, at first blush the code shown should work<BR><BR>ie<BR>&#060;input type="hidden" name="search_string" value="&#060;%=search_string%&#062;"&#062; <BR><BR>could also do<BR><BR>Response.Write &#060;input type=""hidden"" name=""search_string"" value=""" & search_string & """&#062;"<BR><BR>or instead of " use &#039;<BR><BR>

  3. #3
    Join Date
    Dec 1969

    Default RE: Still having problems with querystring

    Just a couple of things, I don&#039;t know how your form is working but do you need to use the querystring from the first page? Could you not try using Request.Form on your hidden field and appending that value to the URL of the page?<BR><BR>Also, have you tried using GET and POST to submit your form? They do behave quite differently in certain cases.<BR><BR>hellz.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts