ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 23rd, 2003, 12:56 PM
janusz_monkey janusz_monkey is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: West Midlands, U.K.
Posts: 47 janusz_monkey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
How to create and use a session variable

Hi,

I have the following code which works for a page:

Code:
  dim lcount, qlist, tlist, dlist, rlist ,llist ,flist, plist , carttotal, icount, price , total
  carttotal=0
  qlist = Session("qty")
  tlist = Session("type")
  dlist = Session("diameter")
  rlist = Session("rod")
  llist = Session("length")
  flist = Session("finish")
  plist = Session("price")
  icount = UBound(qlist)
  for lcount = 1 to icount
  price = Clng(plist(lcount))
  total = CLng(plist(lcount)) * CLng(qlist(lcount))
  carttotal=carttotal + total
  %>


How do I make "carttotal" a session variable so it can be used on another page in the folloing bit of code:

Code:
<%=FormatNumber(carttotal, 2, -2, -2, 0)%>
<%Session("cost")=FormatNumber(carttotal, 2, -2, -2, 0)%>


and how would the 2nd part of code change?

Many thanks in advance,

Janusz
__________________
http://www.xlibris.co.uk
http://janusz.monkey-it.co.uk

Reply With Quote
  #2  
Old October 23rd, 2003, 02:38 PM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 12th Plane (10500 - 10999 posts)
 
Join Date: Jun 2003
Posts: 10,982 Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 1 Day 18 h 42 m 27 sec
Reputation Power: 814
Unless I'm missing something obvious, use

Session("carttotal") = carttotal in the first page

carttotal = Session("carttotal") in the 2nd page

Reply With Quote
  #3  
Old October 23rd, 2003, 03:05 PM
janusz_monkey janusz_monkey is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: West Midlands, U.K.
Posts: 47 janusz_monkey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
D'oh

So how would both sets of code now look? I've tried what you suggested but it dont work, maybe I coded it wrong.

Janusz

Reply With Quote
  #4  
Old October 23rd, 2003, 03:34 PM
janusz_monkey janusz_monkey is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: West Midlands, U.K.
Posts: 47 janusz_monkey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
First page now looks like:

Code:
<%  
  dim lcount, qlist, tlist, dlist, rlist ,llist ,flist, plist , carttotal, icount, price , total
  carttotal=0
  qlist = Session("qty")
  tlist = Session("type")
  dlist = Session("diameter")
  rlist = Session("rod")
  llist = Session("length")
  flist = Session("finish")
  plist = Session("price")
  carttotal = Session("carttotal")
  icount = UBound(qlist)
  for lcount = 1 to icount
  price = Clng(plist(lcount))
  total = CLng(plist(lcount)) * CLng(qlist(lcount))
  carttotal=carttotal + total
  %>


Second page looks like:

Janusz
Code:
<%=FormatNumber(Session("carttotal"), 2, -2, -2, 0)%>


But it still won't show the price on the second page!

Janusz

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > How to create and use a session variable


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT