Results 1 to 34 of 34

Thread: get the querystring?

  1. #1

    Thread Starter
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    how do i get the querystring?
    http://www.mysite.com/site.asp?Hello

    i want the query string to return "hello"



  2. #2
    Fanatic Member Ianpbaker's Avatar
    Join Date
    Mar 2000
    Location
    Hastings
    Posts
    696
    Hi da_silvy

    in the url you need http://www.mysite.com/site.asp?sometext=Hello

    and in the asp page all you need is

    myvar = Request.QueryString("sometext")

    Hope this helps

    Ian
    Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!

  3. #3

    Thread Starter
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    thanks

  4. #4

    Thread Starter
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    is there a web site which lists objects and methods for asp?

  5. #5
    Fanatic Member Ianpbaker's Avatar
    Join Date
    Mar 2000
    Location
    Hastings
    Posts
    696
    http://www.4guysfromrolla.com is a very good asp site
    Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!

  6. #6

    Thread Starter
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    i'm a beginner
    i tried this code
    Code:
    <%
    Dim myVar
    myVar = Request.QueryString("name")
    Reponse.Write(myvar)
    %>
    and it stuffed up, it says internal server error???

  7. #7
    Fanatic Member Ianpbaker's Avatar
    Join Date
    Mar 2000
    Location
    Hastings
    Posts
    696
    There'snothing wrong with that code, I think you have a problem with your server
    Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!

  8. #8

    Thread Starter
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    how do i retrieve the date?

    do you know?

  9. #9

    Thread Starter
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    what host do you use, if any?

  10. #10

    Thread Starter
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    yes, the server has something wrong with it,

    it wouldn't even work for :
    Code:
    <%
    Reponse.Write("heloi")
    %>
    so what host do you use?

  11. #11
    Fanatic Member Ianpbaker's Avatar
    Join Date
    Mar 2000
    Location
    Hastings
    Posts
    696
    I don't do any ASP at home I only do it at work, and we have are own servers. what host are you using?. Install PWS from the win98 CD and try running your code locally first, before uploading it

    Ian
    Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!

  12. #12
    Fanatic Member Ianpbaker's Avatar
    Join Date
    Mar 2000
    Location
    Hastings
    Posts
    696
    as for the date, to get the date from the server use now(), the same as in VB
    Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!

  13. #13

    Thread Starter
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    thankyou very much, does interdev do anything?

  14. #14
    Fanatic Member Ianpbaker's Avatar
    Join Date
    Mar 2000
    Location
    Hastings
    Posts
    696
    the latest version, 6, is a very good development tool for all scripting languages and is my tool of choice for ASP and javascript

    glad I could help

    Ian
    Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!

  15. #15

    Thread Starter
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    so am i, i installed pws, and my asp page worked! yay!

  16. #16

    Thread Starter
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    is there a way that i can keep updating the current time?

  17. #17
    Fanatic Member Ianpbaker's Avatar
    Join Date
    Mar 2000
    Location
    Hastings
    Posts
    696
    you need a java applet for that, there are 100's around
    Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!

  18. #18

    Thread Starter
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    ok, thank you (yet again)

  19. #19
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    Manchester
    Posts
    446

    hi Ianpbaker

    Seems like your the man for this one

    How can i get each value in a request.querystring... thats a big query string though

    main.asp?success=1&REPORT_INFO:USER=user1&REPORT_INFO:SERVICE=access&REPORT_INFO:SERVICE=Access&REPO RT_INFO:PRICE_COUNTRYID=1 &REPORT_INFO:PRICE_CURRENCY=None&REPORT_INFO:RENTAL_PERIOD=1&ACCESSPRICEINPUT:CUSTSITE:0=""&ACCESSPR ICEINPUT:CUSTTELCODE:0="" &ACCESSPRICEINPUT:CUSTCITY:0=""&ACCESSPRICEINPUT:CUSTDISTRICT:0=""&ACCESSPRICEINPUT:CUSTPOSTCODE:0=" " &ACCESSPRICEINPUT:CUSTSTREET:0=""&ACCESSPRICEINPUTESTSITE:0=""&ACCESSPRICEINPUT:TARIFFTERM:0=0 &ACCESSPRICEOUTPUT:CUSTSITE:0=Site&ACCESSPRICEOUTPUTESTSITE:0=Munchen&ACCESSPRICEOUTPUTISTANCE:0=323.22198486328125 &ACCESSPRICEOUTPUT:TARCONNECT:0=3792.97509765625&ACCESSPRICEOUTPUT:TARIFF:0=2.048M E1 Intl&ACCESSPRICEOUTPUT:TARRENTAL:0=12487.5576171875 &ACCESSPRICEOUTPUT:CUSTSITE:1=TOTAL&ACCESSPRICEOUTPUTESTSITE:1=""&ACCESSPRICEOUTPUTISTANCE:1=323.22198486328125 &ACCESSPRICEOUTPUT:TARCONNECT:1=3792.97509765625&ACCESSPRICEOUTPUT:TARIFF:1=""&ACCESSPRICEOUTPUT:TAR RENTAL:1=12487.5576171875


    told you..

    Many thanks

  20. #20

    Thread Starter
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    does that work?

  21. #21
    Fanatic Member Ianpbaker's Avatar
    Join Date
    Mar 2000
    Location
    Hastings
    Posts
    696
    it did the last time I used it
    Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!

  22. #22
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    Manchester
    Posts
    446

    ?

    Cant spcuify each param becuase each param changes.

    here's what some kind person sent
    Private Function results()
    dim i
    Dim strURL
    Dim strQueryString
    Dim varNameValuePairs
    Dim varSplitPair
    Dim intIndex
    Dim strHTML

    ' Sample URL below - use your super long string value below instead.
    strURL = Request.QueryString

    ' Get QueryString from URL.
    strQueryString = Mid(strURL, Instr(1, strURL, "?") + 1)
    ' Split the QueryString into an array of Name/Value pairs.
    varNameValuePairs = Split(strQueryString, "&")
    strHTML = strHTML & "<TABLE BORDER=""0"">" & vbcrlf
    For intIndex = LBound(varNameValuePairs) To UBound(varNameValuePairs)
    ' Split Name/Value pair into seperate values.
    varSplitPair = Split(varNameValuePairs(intIndex), "=")
    strHTML = strHTML & "<TR>"
    strHTML = strHTML & "<TD>" & varSplitPair(0) & "</TD>"
    strHTML = strHTML & "<TD>=</TD>"
    strHTML = strHTML & "<TD>" & varSplitPair(1) & "</TD>"
    strHTML = strHTML & "</TR>" & vbcrlf
    Next
    strHTML = strHTML & "</TABLE>" & vbcrlf

    Response.Write strHTML
    end Function

  23. #23
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    Manchester
    Posts
    446

    save button

    So is it possible to have a save button at the bottom of the page should ther user wish to save results??

    Cheers

  24. #24
    Fanatic Member Ianpbaker's Avatar
    Join Date
    Mar 2000
    Location
    Hastings
    Posts
    696
    where you say they can change each time you can use the following code to get at all of them and do what you want with them

    <HTML>
    <body>
    <%
    Dim params
    Dim item

    Set params = Request.QueryString

    For each item in params
    'Replace this code with what ever you need to do with iy
    Response.Write item & " " & params(item) & "<BR>"
    Next
    %>
    </BODY>
    </HTML>
    Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!

  25. #25
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    Manchester
    Posts
    446

    save

    How could i save the posted results from the htm page.
    Many Thanks

  26. #26
    Fanatic Member Ianpbaker's Avatar
    Join Date
    Mar 2000
    Location
    Hastings
    Posts
    696
    Do you mean,to save all those variables to a file or a database for example. by the way I would use the way I show'd you for getting the information as it is a lot more tidy. (sorry, I didn't see your earlier posts_

    Ian
    Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!

  27. #27
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    Manchester
    Posts
    446

    yes

    Not a database though, must go to users h/drive as .htm file. Is there a simple way to do this?

    Many thanks

  28. #28
    Fanatic Member Ianpbaker's Avatar
    Join Date
    Mar 2000
    Location
    Hastings
    Posts
    696
    right, got you. bear with me for a little while and i'll nock something up for you.

    Ian
    Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!

  29. #29
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    Manchester
    Posts
    446

    nice one

    WEY HEY many thanks

  30. #30
    Fanatic Member Ianpbaker's Avatar
    Join Date
    Mar 2000
    Location
    Hastings
    Posts
    696
    Right I;ve done it but their is a slight problem. I can only save it on the server, not on the local machine. what you need to do is find a way to copy it from the server to the local machine, and unfortunatley I dont't know how to do that.

    ok on with the show. this first page show's what the user want's to save and has the button at the bottom with the ability to save the query string in a HTML Format.

    Code:
    <HTML>
    <body>
    <%
    Dim params
    Dim item
    Dim strQueryString
    
    'Get the querystring as it is
    strQueryString = Request.QueryString
    
    
    'Get the query string so you can print it out easily
    Set params = Request.QueryString
    
    
    For each item in params
    	Response.Write item & " " & params(item) & "<BR>"	
    Next
    %>
    <br>
    'Pass the query string to save the information
    Do you want to save this
    <input type="button" onclick="window.location = 'save.asp?<% = strQueryString%>'" value="yes">
    </BODY>
    </HTML>
    then in save.asp put the following code

    Code:
    <%
    Dim fs
    Dim newhtmpage
    Dim Params
    Dim Item
    
    ' create a new filesystem object
    Set fs = CreateObject("Scripting.FileSystemObject")
    
    'create a new file
    Set newhtmpage = fs.CreateTextFile("put in where you want so store it onto the server", True)
    
    Set Params = Request.QueryString
    
    'Start off the html file
    newhtmpage.WriteLine("<HTML>" & vbNewLine & "<BODY>")
    
    For each Item in Params
            'put in the values, you can format this how you like
    	newhtmpage.WriteLine(Item & " " & Params(Item) & "<BR>")
    Next
    
    newhtmpage.WriteLine("</BODY>" & vbNewLine & "</HTML>")
    'close the file
    newhtmpage.Close
    
    
    Set fs = Nothing
    Set newhtmpage = Nothing
    %>
    <HTML>
    <BODY>
    Saved
    </BODY>
    </HTML>
    as I said this will, save it on the server and not on the local machine, but you 50% of the way with this

    hope it helps

    Ian
    Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!

  31. #31
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    Manchester
    Posts
    446

    so

    If i'm debugging locally iews with Visual InterDEV AND BACK OFFICE where is the file actually being stored.

    Cheers

  32. #32
    Fanatic Member Ianpbaker's Avatar
    Join Date
    Mar 2000
    Location
    Hastings
    Posts
    696
    on the line


    Set newhtmpage = fs.CreateTextFile("put in where you want so store it onto the server", True) is where you specify where you want the file to be saved.

    You I think you need to use winsock to transfer the file to the remote pc, but I know nowt about that although their are quite a few guys that do and should be able to help you.

    Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!

  33. #33
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    Manchester
    Posts
    446

    well done

    I just added c:\place\results.htm and it worked.. many thanks
    Gary

  34. #34
    Fanatic Member Ianpbaker's Avatar
    Join Date
    Mar 2000
    Location
    Hastings
    Posts
    696
    no worries - glad I could help, but sorry I can't help with the second part
    Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!

Posting Permissions

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



Click Here to Expand Forum to Full Width