Forum Moderators: open

Message Too Old, No Replies

Simple Form Results Script

Add numbers to show total

         

leaseboy

3:24 pm on Aug 31, 2005 (gmt 0)

10+ Year Member



I'm a newbie, so please excuse my ignorance. I have a simple web form with 9 yes/no questions using radio buttons. Each "no" answer has a value of "0", and each "yes" answer has a value of between "1" and "4".

When the user completes the form and clicks the submit button, I want a new page to open with the calculated total using the sum of all 9 questions in the form.

Can someone tell me how this is done?

Thanks!

jatar_k

5:34 pm on Aug 31, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



well this wouldn't be a javascript question really. Do you have a scripting language you could use to do this? (asp/php/perl)

Hard to say, there are ways you could do this with javascript but what is your expected behaviour? Do you just want the new page to give you the total? or did you want to do something with the total?

leaseboy

6:19 pm on Aug 31, 2005 (gmt 0)

10+ Year Member



Hi jatar_k,

Scripting language is ASP. All I want it to do is show the total.
Thanks,

jatar_k

6:26 pm on Aug 31, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



you could use javascript and show the total in an alert box or you could go to a new page and then I would suggest asp as the solution for processing the form.

if you want the asp route I can move this thread for you else maybe someone can offer a js solution

leaseboy

8:04 pm on Aug 31, 2005 (gmt 0)

10+ Year Member



Please move the thread for me. Thanks.

jatar_k

8:07 pm on Aug 31, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



maybe someone can offer some asp advice on accessing posted form values

Easy_Coder

9:10 pm on Aug 31, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Have you tried something like this...

nCounter = 0

if request.form("control_1") = "no" then
nCounter = nCounter + 1
end if

if request.form("control_2") = "no" then
nCounter = nCounter + 1
end if

EDIT... scratch that suggestion, it's wrong. Can I see a snippet of your radio button controls?

Easy_Coder

12:24 am on Sep 1, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I stickied you back a solution...