passing values...the most effective way

Results 1 to 6 of 6

Thread: passing values...the most effective way

  1. #1

    Default passing values...the most effective way

    What is the most effective way of passing values across many pages. As an example, if a user was completing an online order form and it was broken down into steps...<BR><BR>say step 1 on the first page, then step 2 on the second page...and so on and so on...<BR><BR>How is it possible to carry the values over many pages, and not just two...and what is the best way to do this?<BR><BR>Ive been told that session variables are quite resource hungry and not the best option. Hidden fields?<BR><BR>Thanks

  2. #2
    Join Date
    Dec 1969

    Default RE: passing values...the most effective way

    You can pass it across the query string, but lots of people use Session varibles.<BR><BR>I personally would use session varibles, just store all the forms fields on the first page into session varibles, then once you are done with what you trying to do with the fields (store then into a DB etc) Then use Session.Abandon to clear all the users session varibles.

  3. #3
    Join Date
    Dec 1969

    Default As Sabastious says...

    ...use session variables.<BR><BR>How many visitors per hour do you have to your site? 2,000? Let&#039;s start with that number.<BR><BR>Say it takes 10 minutes to fill out both pages of your form. Take the worst possible case and say that every single person who comes to the site fills in the first page and then shuts down his/her browser, so that you have to wait for the Session timeout. <BR><BR>So that means you need 1,000 simultaneous sessions.<BR><BR>Okay, now say you have 50 fields on the first page of that form. And say that, on average, each field uses 30 characters of input. And say you store each field in a different session variable (not the most efficient way, but the simplest). And say that the names of the fields and session variables run 20 characters each. Each name *and* each value needs 24 bytes plus two times the number of characters. So the average name/value pair, as a session variable is<BR> 24 + 2*30 + 24 + 2*20<BR>or 148 bytes. Call it 150. And we said you have 50 such fields. 7500 bytes. Let&#039;s use overkill and say it is thus 10K bytes per session/user.<BR><BR>Times 1,000 simultaneous users.<BR><BR>Or a total of 10MB. <BR><BR>Now, that *is* a noticeable amount of memory. But "resource HUNGRY"???? I don&#039;t think so.<BR><BR>DO THE MATH. <BR><BR>And if you have 20,000 visitors per hour, then you need 100MB for session variables. At that point you presumably also need a dedicated web server and a dedicated database server just to handle all the other things going on. But with 20,000 visitors per hour, hopefully you can afford it.<BR><BR>

  4. #4

    Default session variables it is!

    is it just a matter of passing them like so...<BR><BR>session("name") = request.form("name") and so on?<BR><BR>whats the "smart" way to do this?<BR><BR>thank you!

  5. #5
    Join Date
    Dec 1969

    Default So easy it'll scare you:

    &#060;%<BR>For Each name In Request.Form<BR> Session(name) = Request.Form(name)<BR>Next<BR>%&#062;<BR><BR>Prest o. Done. You just copied every form field name and value.<BR><BR>And so on page 3, you get the stuff from page 2 via<BR> Request.Form("whatever")<BR>but you get the stuff from page 1 via<BR> Session("something")<BR><BR>What could be simpler?<BR><BR>

  6. #6

    Default ok you scared me...

    ..can we turn on the lights now?<BR><BR>Thanks guys,<BR>John

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts