Re: unknown number of inputs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




PJ wrote:
I have a script with $_POST and <form> to load data with text input.
Situation: enter name of author(s) for book. I have the script set up to
enter first_name, last_name for Author1 and the same for Author 2.
Check if entry 1 exists then proceed accordingly
Check if entry 2 exists then proceed accordingly.
Now, If I have three or more authors to enter, is there a way to add a
radio button to add more rows for input or to skip further inputs, if I
have to enter the inputs for each additional author?
I'm looking for a simple way to do this. Could or should Ajax be
involved in this somehow?


Here's the way I do it, especially if typically the number of entries are small. e.g., 4 or so.

Show the 4 and let the user Submit them.

Then, if they used all 4, return the page with an additional 4. Show all 8.

Then, if they've used all 8, repeat until they leave at least one unused. Process the page.

Make the batch size a constant that you can easily change. And consider making the first rendering say 6 and subsequent additions 3, or whatever.

If you want to get a little fancy. Make a simple log file for the total number of entries. After the application has been used for a while, you can check the log and adjust your batch size constant(s) accordingly.

Al....

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux