asp increment help

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
 
P

Paul C

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
 
P

Paul C

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
 
B

Bob Lehmann

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
 
M

Mark Fitzpatrick

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.
 
P

Paul C

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
 
P

Paul C

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top