asp increment help

  • Thread starter Thread starter Paul C
  • Start date Start date
P

Paul C

Hi I am trying to have a submit once to a form using asp . The idea I have
is to incriment a dim by 1 everytime the script runs and then set up
something like


Dim xonce
if
xonce = "2" then Response .write "the form has already been submitted"
else

how would I first set up the dim to increment and then response write when
it has

Thanks
Paul M
 
Thinking on it should be something like

Dim xonce
if
xonce is more than "1" then Response .write "the form has already been
submitted"
else

paul M
 
Just, thought it won't work will it? when the page refreshes the dim xonce
won't hold its value so it won't increment
how is submit once usually done?
Thanks
Paul M
 
how is submit once usually done?
By making xonce a session varible.

dim xonce
xonce = session("xonce")
if xonce = 0 then session("xonce") = xonce + 1
response.write "OK to process"
' you wouldn't actually do the response write
' you would handle the form
else
response.write "You already submitted this form"
' you wouldn't necessarily do the response write
end if

If you wanted to persist for a period of time longer than the session you
would have to use a cookie, or have some type of log in functionality.

Bob Lehmann
 
If you want to store it in memory you have two choices, as an Application
variable so that it is incremented no matter who the user is, or a Session
variable if you only want to keep track of it based upon the current user.

Ideally though, you want this in a database if you really want a permanent
record, otherwise the data will be lost once the application is unloaded
from the server's memory which happens when the last session expires.
 
Thanks Bob
Paul M

Bob Lehmann said:
By making xonce a session varible.

dim xonce
xonce = session("xonce")
if xonce = 0 then session("xonce") = xonce + 1
response.write "OK to process"
' you wouldn't actually do the response write
' you would handle the form
else
response.write "You already submitted this form"
' you wouldn't necessarily do the response write
end if

If you wanted to persist for a period of time longer than the session you
would have to use a cookie, or have some type of log in functionality.

Bob Lehmann
 
Thanks Mark
Paul M

Mark Fitzpatrick said:
If you want to store it in memory you have two choices, as an Application
variable so that it is incremented no matter who the user is, or a Session
variable if you only want to keep track of it based upon the current user.

Ideally though, you want this in a database if you really want a permanent
record, otherwise the data will be lost once the application is unloaded
from the server's memory which happens when the last session expires.
 
Back
Top