It is possible create Seasson variable (ASP) through VBscript?
How i can create Seasson variable (ASP) through VBscript
Collapse
X
-
-
Of course it isn't.i want to do somthing like that but its not working
Code between <% and %> is executed at the server and the <script type = text/vbscript> is executed at the browser (IE engine browsers only to my knowledge).
You therefore have to post the value you want to store in session back to the server using Post or Get and then assign it like I illustrated above.
GazComment
-
look what i wrote :
i want to build asp store but simple not somthing hard and at the other page like order.asp i dont know how to find which product the Ueser/client choseCode:<% Dim n n = 1 %> <html> <head> <script type="text/vbscript" language="VBScript" > Sub buy(obj) <% Session("productID") = %>&obj.name Msgbox "<%=Session("productID")%>" end sub </script> </head> <body dir="center"> <% path = Server.mappath("../db/ServerData.mdb") set con = Server.createobject("ADODB.Connection") con.open "driver={Microsoft Access Driver (*.mdb)};DBQ="&path set r = con.execute("select * from products") response.write "<form method='post' >" response.write "<table border='0' width='100%' cellspacing='50px'>" response.write "<tr>" response.write "<th>Number</th>" response.write "<th>Name</th>" response.write "<th>Picture</th>" response.write "<th>Description</th>" response.write "<th>Price</th>" response.write "<th>Quanty</th>" response.write "<th>Order</th>" response.write "</tr>" do until r.eof response.write "<tr>" response.write "<td>"&r.fields("ItemID")&"</td>" response.write "<td>"&r.fields("Name")&"</td>" response.write "<td><img src='"&r.fields("Picture")&"'></td>" response.write "<td>"&r.fields("Description")&"</td>" response.write "<td>"&r.fields("Price")&"</td>" response.write "<td><input type='text' size='1' value = '1' ></td>" response.write "<td><input type='submit' onclick='buy(me)' value='buy this product' name='"&n&"'></td>" response.write "</tr>" n=n+1 r.movenext loop response.write "</table>" response.write "</form>" %> </body> </head> </html>Comment
-
Next time use code tags. Please read up on "how to ask a question" located here -> http://bytes.com/faq.php?faq=how_to_ask_a_question.
Please do post code without code tags in the future.Comment
Comment