Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.

Thread: Using Numeric Data Collected From Forms

1. Using Numeric Data Collected From Forms

Hello,

I'm having a problem using a numeric data element submitted by my form. I'm checking for a numeric value, but it seems to be coming in blank. Is it necessary to convert the item to an integer?

*** This code doesn't work - Num_PPAC form item sets TNT:
If ((Request("Num_PPAC") <> "") And (isnumeric(Request("Num_PPAC")))) Then

TNT = CInt(Num_PPAC)

If Request("GenCodes") <> "" Then
X = 1
Do while X <= TNT
RandStuff = RndStr(7,"123456789abcdefghijkmnpqrstuvwxyz")
Temp_PPADCode(X) = Request("PPAC_PREFIX") & RandStuff
X = X + 1
Loop
pMsg = "TNT&nbsp;=&nbsp;" & TNT

End If

*** This code does work - TNT set to 10:
If ((Request("Num_PPAC") <> "") And (isnumeric(Request("Num_PPAC")))) Then

TNT = 10

If Request("GenCodes") <> "" Then
X = 1
Do while X <= TNT
RandStuff = RndStr(7,"123456789abcdefghijkmnpqrstuvwxyz")
Temp_PPADCode(X) = Request("PPAC_PREFIX") & RandStuff
X = X + 1
Loop
pMsg = "TNT&nbsp;=&nbsp;" & TNT

End If

Thanks.

• this is a javascript forum and not an ASP forum. you should have posted in the right forum.
Anyway, here's the answer.

if the item you request is used many times, it is advisable to put it in a variable. And it is also more efficient if you specify what request collection you are accessing rather than just specifying Request(item)

dim ppac
ppac = Request.Form("Num_PPAC") 'if method is POST
'ppac = Request.Querystring("Num_PPAC") 'if method is GET
If ppac <> "" And isnumeric(ppac) Then

TNT = CInt(ppac)
...

• Thanks

Hey Glenn,

I just wanted to say thanks for your help, and to let you know that now my code is working fine, plus I've learned more about ASP and forms.

•

Posting Permissions

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