[thelist] newbie: why <input name="something[]" ... /> ?

Zhang Weiwu zhangweiwu at realss.com
Wed Aug 24 20:33:55 CDT 2005


Hello. this is really a stupid question and I believe there are tons of
answers on the Internet, but if I search I must use the keyword "[]"
which simply gets ignored by google.

Why I see a lot of people adding an empty [] after the variable name
used in <input> ? Is there a good reason?

After I did some rough test it seems to me submitting by GET can
generate more then one value for an variable:

result.php?varname=abc&varname=def&varname=hij;

however submtting by POST generate only one value for one name;

result.php?varname=hij;

even if there are many <input name="varname" .../>, only the last value
is submitted.

Is this the only/real reason to use empty []?


More information about the thelist mailing list