FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Multiple Forms





bluffmango
is is possible to set multiple form actions for a web form.... and is it possible to have a single submit button for two forms e.g one form sends data to the email and other one checks if the Credit card entered is valid thru a cgi script? can it be done thru one click???
SystemWisdom
You cannot set multiple actions for a single form, but you can create two seperate forms on one page, and have a javascript send both forms one after the other. This can be controlled with a single button pointing to the javascript.

I would give a sample, but there are just too many ways of doing this...
bluffmango
out of those many ways please write an easy and good one ...
Rhysige
Whats to prevent you having multiple actions for a single form? just grab the correct fields and process it accordingly...
kv
SystemWisdom wrote:
You cannot set multiple actions for a single form, but you can create two seperate forms on one page, and have a javascript send both forms one after the other. This can be controlled with a single button pointing to the javascript.

I would give a sample, but there are just too many ways of doing this...


I don't think this is possible. Once you submit a form, the control goes back to the server. If it was possible, I should be able to make multiple requests to different servers simultaneously. I don't think browsers are designed to handle this.
SystemWisdom
Rhysige wrote:
Whats to prevent you having multiple actions for a single form? just grab the correct fields and process it accordingly...


Not possible.. The form data is sent to the first action, and the second action will never be called.

kv wrote:

I don't think this is possible. Once you submit a form, the control goes back to the server. If it was possible, I should be able to make multiple requests to different servers simultaneously. I don't think browsers are designed to handle this.


What I mentioned is possible. Your server can chain the actions. Either use 2 forms or use a hidden input type.

bluffmango wrote:
out of those many ways please write an easy and good one ...


As I said, there are too many ways to do this (logically) and I am unsure which way you need it to work. I would hate to write a useless sample.

For reference tho:

Chained actions: <input type="hidden" name="nextAction" value="somepage.php">

JS calling both actions: document.forms[0].nextAction.value=document.forms[1].action;
document.forms[0].submit();

With chained actions, you just force the server to load the target of the next action, passing the same data values as used for the first action.
aningbo
using a javascript to process a credit card info wont be that secure..try using php.

and yeah as pointed out earlier... the second function wil never be called! will get back if needed b .
Related topics
Anyone that can give me help/suggestions for forms?
What is the path to Perl?
handling the $_POST array
Best WordPress Plugins for unfair advantage over others
Multiple File Extentions in C#
Capturing multiple USB cams to an AVI or MPEG file.
Multiple versions of PHP/MySQL
Sacred: Underworld
Multiple Moving?
Bluetooth
warning
basic tutorials on most forms of web programming
Aliens - Myth or reality?
"Forms To Go" create scripts in PHP, ASP and Perl
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.