Forum Moderators: open
I have a form page where the user submits information to the server. I've built this page to be very dynamic, but to not require the reload of the page as the user progresses through the form options (which are split into different DIV tags so that I can hide certain sections and walk them through step by step). But now I've hit a wall. At one point in the form, the user needs to fill in a set of fields. This set of fields is dependent on a choice they made earlier in the form. I need to be able to read the choice they made earlier (which I'm doing with document.getElementById) and then, when they're finished with the entire form process, submit the values of this 'unique' section.
My problem is this:
I can't seem to figure out a way to change which fields are displayed without having them all written to the page at the same time. I do this and hide the fields that I don't want filled in, but then I have multiple fields with the same name, which gives undesirable results on submission.
Does anyone have any ideas on what I can do?
One thought is to not use the same field names, but to use unique ones and then have my PHP form handling script decide which values are supposed to be used. But I didn't know if there was a better way.
I use an onClick event to set the src of an iframe to a page that takes a url variable from that src and assigns it to a session variable. Then, when the form is submitted, the site has the necessary information in the session variable.
It's not the cleanest method, I'm sure, but it's working...