how do i get the querystring?
http://www.mysite.com/site.asp?Hello
i want the query string to return "hello"
Printable View
how do i get the querystring?
http://www.mysite.com/site.asp?Hello
i want the query string to return "hello"
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
thanks
is there a web site which lists objects and methods for asp?
http://www.4guysfromrolla.com is a very good asp site
i'm a beginner
i tried this code
and it stuffed up, it says internal server error???Code:<%
Dim myVar
myVar = Request.QueryString("name")
Reponse.Write(myvar)
%>
There'snothing wrong with that code, I think you have a problem with your server
how do i retrieve the date?
do you know?
what host do you use, if any?
yes, the server has something wrong with it,
it wouldn't even work for :
so what host do you use?Code:<%
Reponse.Write("heloi")
%>
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
as for the date, to get the date from the server use now(), the same as in VB
thankyou very much, does interdev do anything?
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
so am i, i installed pws, and my asp page worked! yay! :)
is there a way that i can keep updating the current time?
you need a java applet for that, there are 100's around
ok, thank you (yet again)
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=""&ACCESSPRICEINPUT:DESTSITE:0=""&ACCESSPRICEINPUT:TARIFFTERM:0=0 &ACCESSPRICEOUTPUT:CUSTSITE:0=Site&ACCESSPRICEOUTPUT:DESTSITE:0=Munchen&ACCESSPRICEOUTPUT:DISTANCE:0 =323.22198486328125 &ACCESSPRICEOUTPUT:TARCONNECT:0=3792.97509765625&ACCESSPRICEOUTPUT:TARIFF:0=2.048M E1 Intl&ACCESSPRICEOUTPUT:TARRENTAL:0=12487.5576171875 &ACCESSPRICEOUTPUT:CUSTSITE:1=TOTAL&ACCESSPRICEOUTPUT:DESTSITE:1=""&ACCESSPRICEOUTPUT:DISTANCE:1=323 .22198486328125 &ACCESSPRICEOUTPUT:TARCONNECT:1=3792.97509765625&ACCESSPRICEOUTPUT:TARIFF:1=""&ACCESSPRICEOUTPUT:TAR RENTAL:1=12487.5576171875
told you..
Many thanks
does that work?
it did the last time I used it
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
So is it possible to have a save button at the bottom of the page should ther user wish to save results??
Cheers
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>
How could i save the posted results from the htm page.
Many Thanks
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
Not a database though, must go to users h/drive as .htm file. Is there a simple way to do this?
Many thanks
right, got you. bear with me for a little while and i'll nock something up for you.
Ian
WEY HEY many thanks
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.
then in save.asp put the following codeCode:
<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>
as I said this will, save it on the server and not on the local machine, but you 50% of the way with thisCode:<%
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>
hope it helps
Ian
If i'm debugging locally ie:pws with Visual InterDEV AND BACK OFFICE where is the file actually being stored.
Cheers
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.
I just added c:\place\results.htm and it worked.. many thanks
Gary
no worries - glad I could help, but sorry I can't help with the second part