Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Assiging a Session Variable in a HREF tag

Status
Not open for further replies.

mdr2271

Programmer
Sep 14, 2005
42
US
I am trying to assign a session variable when someone clicks on a hyperlink. A querystring assignment won't work for what I need so am trying to figure out how to get a session variable assigned on when someone clicks on a hyperlink.
 
Clicking is a client-side activity.

...Of course clicking a link will cause the browser client to request a file from the web server.

Now if the request file is a script then it could certainly take some server-side action like setting a session variable...
 
yes Sheco is correct...try something like this:

<a href= "#" ONCLICK = 'ViewDetail("<%=session("blah")%>")'>Click Here</font></a>

<script language="VBscript">
Sub ViewDetail(myval)
Window.Location= "mypage.asp?myval="&myval
End Sub
</script>

then you can access myval on mypage.asp using request.querystring("myval")

-DNG
 
I am trying to assign a session variable when someone clicks on a hyperlink. A querystring assignment won't work for what I need so am trying to figure out how to get a session variable assigned on when someone clicks on a hyperlink.

Well lots of things like search engines and banner ads have a tabulator page that they go to with info about the ultimate URL location contained in the querystring:



Best regards,
J. Paul Schmidt, Freelance Web and Database Developer
Access Database Sample, Web Database Sample, ASP Design Tips
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top