Re: Re: unknown number of inputs

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

 





Phpster wrote:


On Apr 10, 2009, at 12:44, Al <news@xxxxxxxxxxxxx> wrote:


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


Why, why make trips to the server when you don't need to? I have an ongoing arguement with the vp from my company ( I'm the director of dev) where he's done the same thing. It is a more complex app and he does it in blocks of ten. But when the clients try to add 100 items, all the processing he does makes that entire process take almost an hour when all is said and done. I keep telling him it should be js only to add new rows, with no trips to the server. But then he's as smart as the guy who wrote the jpeg image compression ;-P

I digress but never make a trip back when you don't need to.

Bastien

Everything is a compromise. I avoid scripts on the client side; just another thing to be concerned about for compatibility.

Todays speeds for servers, browsers and the net are so fast one can hardly get their finger off the mouse button before pages are replaced.

For 100 rows, sounds to me like you need a complete application on the client side that does all or most of the processing. Must take an hour for your users to simple enter data into 100 rows.

--
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