TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   General (http://www.talkphp.com/general/)
-   -   Form adds (http://www.talkphp.com/general/5137-form-adds.html)

wmpl 11-27-2009 12:43 AM

Form adds
 
Typically we use one submit at the end of one form to place inputs into dbase. BUT:
1) Can two forms have ONE submit?
2) Can one form have two separate browser pages (sequential)?

If someone is interested in what I'm trying to do, it is to have two separate input browser pages (sequential) place their inputted form data together (in an ordered way) in ONE dbase (one MySQL db table row).
THX

delayedinsanity 11-27-2009 03:19 AM

1) Yes, make them one form, and they have one submit.

There is no protocol for POST1, POST2, etc. So everything you send, either via GET or POST is technically being sent as a single string of data. If you wanted to, you could nest an array inside of $_POST. Use names for your inputs such as;

html Code:
<input type="text" name="form_one[option_one]" value="" />
<input type="text" name="form_two[option_one]" value="" />

2) Yes, but again it's not technically the same form. You can post data from one form to the next and than pass it on the second time either via hidden inputs, session variables, ajax, etc.

There's a lot of possibilities for ways to handle this. Handle the forms as they come and just insert data fragments until you've got a complete row; place the data from the first table into a meta table that the second form will use to complete the row in the actual table; as mentioned above, pass the data along through hidden inputs and re-validate it on the other side of the second form; store it in session variables that the second forms handler will use to complete the query; etc.


All times are GMT. The time now is 11:53 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0