PDA

View Full Version : difference in creating multiple input elements with the same name


jayapalchandran
03-31-2008, 12:38 PM
--server side script - i am creating the following--
for() 5 times
<input type="text" name="sam[]">

OR

-- server side script - i am creating the following ---

for() 5 times
<input type="text" name="sam">

for both the above 5 elements will be created...

when accessing in javascript what is the difference...

Kor
03-31-2008, 12:43 PM
the difference is the name attribute values. Still I don't quite understand your problem...

peteyb383
03-31-2008, 01:22 PM
You're making an array in the first one that could be used for storing values into a database, and the second one makes 5 elements that all have the same name, not a good idea.