Page 1 of 1
One submit button for 3 forms
Posted: Fri Dec 05, 2008 9:09 am
by hellboy83
Hi Guys,
I have a situation in here regarding forms.
I have 3 different forms, each one with it's own MySQL table
to be filled by a single user but instead of having 3 submit buttons for each form i want to have
one submit button for all the 3 forms.
In other words:
After filling the third form the user hits submit button and it sends the data on the first, second and third form to
each correspoding table.
How can i structure this?
Re: One submit button for 3 forms
Posted: Fri Dec 05, 2008 9:34 am
by papa
One form divided by <br /> tags.
Re: One submit button for 3 forms
Posted: Fri Dec 05, 2008 9:39 am
by deejay
you'll need to have mutiple INSERT queries.
jsut filter everything you've got in $_POST into the write tables.
you may need mysql_insert_id(); if you want table ids to go into any following tables.
I hope that helps.
Re: One submit button for 3 forms
Posted: Fri Dec 05, 2008 9:39 am
by hellboy83
Ok i agree with you papa
But it's gonna be a huge scrolling from the top to the bottom of the browser since my forms are huge. Is there any way of breaking that one form in partes?
Part 1 Part 2, etc etc
Re: One submit button for 3 forms
Posted: Fri Dec 05, 2008 11:40 am
by watson516
hellboy83 wrote:Ok i agree with you papa
But it's gonna be a huge scrolling from the top to the bottom of the browser since my forms are huge. Is there any way of breaking that one form in partes?
Part 1 Part 2, etc etc
If you broke it up into parts, would that not be the same thing as having the user fill out 3 different forms? If you do the parts idea, you could replace the submit button with a 'Part 2' image and some javascript that submits the form. Deal with that first 'part' and then show the second part.
Or, you could do something like having one giant form but put each 'section' into it's own div and using javascript hide the current section and display the next.
Re: One submit button for 3 forms
Posted: Fri Dec 05, 2008 2:20 pm
by John Cartwright
What I would do is have a single form, and use javascript to toggle between what div is displayed, and thus hidding the others. If the user did not have javascript enabled, it would allow you to degrade gracefully and just show all the forms at once.