|
Posted by Jerim79 on 04/04/07 15:12
On Apr 4, 8:51 am, l...@portcommodore.com wrote:
> On Apr 4, 5:27 am, "Jerim79" <m...@hotmail.com> wrote:
>
>
>
> > I need to create a form that takes a number that the user enters, and
> > duplicates a question the number of times the user entered. For
> > instance, if the customer enters 5 on the first page, when they press
> > next the form generates "How old are you?" 5 times on the page. The
> > customer will answer all 5 questions then press next. Finally, all the
> > local variables get dynamically created and written to a database.
>
> > I have already taken care of dynamically creating the question five
> > times. Using a simple WHILE clause, this generates the correct number
> > of questions. What I am having an issue with at this point, is how to
> > dynamically create the local variables.For instance, for the question
> > "How old are you?" I would need a unique variable for each instance;
> > using something like $Age(n). So that for five times, it would
> > automatically created variables $Age1 through $Age5. I have carried
> > over the number to the submit page by creating the variable $Number
> > and passing it along as hidden button on the form. $Age'$Number'
> > seemed to work for creating the variable, but $_post["Age'$Number'"]
> > doesn't work for referencing the global variable. I would need some
> > way of looping through and dynamically creating the variables.
>
> > I am willing to rethink my approach to the whole problem, so the door
> > is wide open to suggestions.
>
> What I do is make a form with a large number of blanks (order form,
> children stats), and then in validation determine which ones are
> filled in.
>
> Now if you want to edit it, you bring the data back in a session array
> (to determine change) and an array for the POST form. When validation
> is good you compare the POSTed data to the session data and do what
> changes are necessary.
>
> This process bypasses the (enter number here) thing as well as the
> confusion in trying to add more child elements at a later time.
That is a very good idea as well. I am just thinking from a user
standpoint. Some users may want only 1 or 2. Some may want 10 or more.
I am just concerned about a user getting confused by having this long
form to fill out. I hate to say it, but users get confused very
easily. As long as I can, I would like to stick with the dynamic
system. That way, if a user only wants 3, then they won't be confused
by 7 extra "mini-forms." What I am attempting to do, is ask 6
questions for each number they type in. So if they type in 5 for the
number, it will ask them 6*5 questions which is 30.
For example, let's say my first page asks "How many concerts have you
been to in the last year?" A user types in 5, and then presses
Continue. The next screen that comes up, asks the user the same 6
questions for each concert they say they have attended, all on one
form. I would hate for the customer to only need to fill out one set
of questions, but get confused by all the rest of the sets on their
and eventually get give up.
Navigation:
[Reply to this message]
|