Changing submit function according to what user selects in pulldown list

C

Claire Osborne

I have made a form at http://www.lcuk.org/cleanair/form.htm

In the Financial Information section there is a question "How do you
wish to pay?"

If the user selects "invoice" then when the user hits submit I want
the form simply to call a formmail.cgi script and email the contents
to me.

However if the user selects "credit card" then I need to pass the form
contents to a second form (http://www.lcuk.org/cleanair/form2.htm) to
be held on a secure server so that the user's credit card details can
be given. The details from the first form need to be written to the
corresponding boxes on the second form.

Is there a way to do all this?

I'm new to all this and would really appreciate some help! Please
assume I'm stupid and know nothing...
 
R

Randy Webb

Claire said:
I have made a form at http://www.lcuk.org/cleanair/form.htm

In the Financial Information section there is a question "How do you
wish to pay?"

If the user selects "invoice" then when the user hits submit I want
the form simply to call a formmail.cgi script and email the contents
to me.

However if the user selects "credit card" then I need to pass the form
contents to a second form (http://www.lcuk.org/cleanair/form2.htm) to
be held on a secure server so that the user's credit card details can
be given. The details from the first form need to be written to the
corresponding boxes on the second form.

Is there a way to do all this?

I'm new to all this and would really appreciate some help! Please
assume I'm stupid and know nothing...

Most reliable way? Submit the form to someScript.cgi and have
someScript.cgi check the payment method and redirect accordingly.

Javascript way? onSubmit, call a function that will set the forms action
property and then submit the form. Doesn't work with js disabled.

Alternative:
Use both. Set the action of the form to the someScript.cgi, and onSubmit
have JS check the payment method, and reset the forms action. Then, if
JS is disabled, the server handles it.
 
K

kaeli


This is an internet application. Do not rely on javascript for internet
applications. You're asking for problems if you do. Not everyone has JS
enabled. What would happen to those people?

IOW, use server-side code to do this for internet applications. Have the
form submit to a page that checks which option to do, then that page
does the appropriate thing.
Most (if not all) server-side scripting languages have the ability to
forward. Edit your formmail script to forward to the other html page if
appropriate.
Check a perl group for details.


--
 

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

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,007
Latest member
obedient dusk

Latest Threads

Top