Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Posting Data from two Forms

Status
Not open for further replies.

bam720

Technical User
Sep 29, 2005
289
US
I have two forms on my page. The top form contains three dropdown list boxes. The reason for this is that the second drop down is dynamically populated after the first has been chosed. Same for the third but based on the second. The bottom form contains three text boxes. What happens is if the user skips the three dropdown boxes and starts filling out the text boxes, then returns to the drop down boxes, anything they have already typed in the text boxes is lost and reset with their initial values. Is there a way that when the top form autosubmits based on the javascript:
Code:
onchange="this.form.submit()"

that the data can be read from the lower textboxes and be stored, either session varibles, post/get array or anything else? I am asking for a starting point or suggestion hence no real code, however if you like/need I can provide code. Thanks.
PS. I have considered this may be possible in Javascripts but wanted to see if php offered a relativly quick/simple way to do this.
 
AFAIK your problem will lie in the fact that you have two forms. If data from one form is submitted, then data from the other is lost. If you would have just one form, it would not be a problem at all. Everytime the data would be submitted, all the fields would be set. From then on it would be a simple task to read the values from $_POST/$_GET array and put them in the appropriate fields.
 
Vrag, is right, why do you have 2 forms?.

If you combine everything into one Form. then you can preserve the values of the textboxes, in the $_POST/$_GET variables, and they can be displayed, when the page refreshes.


----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top