Learn Scripting Languages from the Master!
Many times it comes necessary to share information between webpages. One of the ways that can be done is by using the querystring method. In the querystring method, the inforamtion is first added to the URL of a web page; then, the inforamtion is requested from the URL. The script below shows you how to use querysting to find out which link the user clicked on. Note that you should avoid sending huge amount of information with the querysting method as the URL will become huge!
First step: add information to the URL of a web page.
<%dim strFileName, strVariableName, strValueToPass, strLinkTextstrFileName = "send-value.asp"strVariableName = "LinkID"strValueToPass = "10"strLinkText = "Click here to send the value!"SendValue strASPFile, strVariableName, strValueToPasssub SendValue (strASPFile, strVariable, strValue)dim shtmlshtml = "<a href='" & strASPFile & "?" & strVariableName & "=" _& strValueToPass & "'>"shtml = shtml & strLinkText & "</a>"response.write shtmlend sub%>Second step: request the information from the URL
<%dim strSentValuestrSentValue = request.QueryString("LinkID")if strSentValue <> "" thenresponse.write "Value sent to this page is: " & strSentValueend if%>To see the output of the above code, click on the link below:
Click here to send the value!