Re: Re: unknown number of inputs

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

 



Shawn McKenzie 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?


Ajax would be a good way to go if it could be an undetermined number of
authors.  But if you have a limit (like 3 or 4 or 5) then just include
the text fields for that number.

For Ajax you might have a button or link that says "add more authors"
and when clicked the javascript adds an additional input to the form.


This isn't a job for AJAX, it is a job for JavaScript.

REF:

AJAX - http://en.wikipedia.org/wiki/Ajax_(programming)

Dynamic Form Generation - http://www.faqts.com/knowledge_base/view.phtml/aid/1785/fid/129

I did a quick Google and came up with the two above examples. Others might have better suggestions. But I just wanted to point out the difference. AJAX, IMO, is bases on JavaScript talking to a server with the intent to send/receive data. DHTML/JavaScript/etc... are was to do what you are asking without ever needing to talk with the server. So it doesn't involve anything that AJAX was designed to solve.

I simply wanted to point out the different uses.  Hope I didn't step on anybodies toes.

--
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
       and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
    by William Shakespeare

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