This is a discussion on Restoring OTHER form field after submit within the alt.comp.lang.php forums, part of the PHP Programming Forums category; Hi Everyone, On an HTML page with 2x different forms, how can I redisplay the same page after a submit, ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi Everyone,
On an HTML page with 2x different forms, how can I redisplay the same page after a submit, restoring the values from BOTH forms even though only one was submitted? I have an existing PHP program that I am modifying, and need to redisplay the same page after a submit (the button that submits is a "change shipping" button, that allows the user to continue with the rest of the page). The problem is that there are TWO forms - the one that allows you to change shipping, and the other where the user can fill in the billing address. Making this into one form is not really an option, due to how the program is set up. Since they are 2 different forms, submitting the "change shipping" form does NOT bring the billing address fields to my PHP code in the POST. This makes restore difficult. I have a couple of kludgy ideas on how to work around this (mostly javascript based - e.g. setting hidden fields in the "change shipping" form when the user is changing the billing fields). However, I was wondering if there were any other easy solution to acheive this. Thanks, Ed Eichman Spain |
|
|||
|
ed_spain wrote:
> Hi Everyone, > > On an HTML page with 2x different forms, how can I redisplay the same > page after a submit, restoring the values from BOTH forms even though > only one was submitted? > > I have an existing PHP program that I am modifying, and need to > redisplay the same page after a submit (the button that submits is a > "change shipping" button, that allows the user to continue with the > rest of the page). The problem is that there are TWO forms - the one > that allows you to change shipping, and the other where the user can > fill in the billing address. Making this into one form is not really an > option, due to how the program is set up. > > Since they are 2 different forms, submitting the "change shipping" form > does NOT bring the billing address fields to my PHP code in the POST. > This makes restore difficult. > > I have a couple of kludgy ideas on how to work around this (mostly > javascript based - e.g. setting hidden fields in the "change shipping" > form when the user is changing the billing fields). However, I was > wondering if there were any other easy solution to acheive this. > > Thanks, > Ed Eichman > Spain > hi, perhaps either of these two ideas could help 1) using 2 distinct forms: include hidden elements that contain the values of the other form use onchange script in the first form to update the hidden elements in the other form post to read both sets of values. 2) use one form : stylize a single form to appear as two distinct forms - group each set of elements into separate div elements you can use 2 submit buttons on a single form so the apparent effect of 2 forms is complete. hth ~S~ |