Reply to Re: Dynamic Form

Your name:

Reply:


Posted by larry on 04/04/07 13:51

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.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация