views:

24

answers:

2

I've noticed in some php applications, that form fields are labelled with [] in them.

Say a shopping cart page, that lists all the items where you can edit the quantity.

is the [] type naming used to get the correct row?

Just trying to figure out how I should name each textbox?

should it be like:

name="quantity-<%= items.RowId %>"

THen when I loop the form fields, I would get the index number?

A: 

This is done in PHP when you need to pass <select multiple="multiple"> to the server, otherwise PHP will catch only the first selected value. Textboxes don't normally require such naming.

naivists
A: 

This might answer a few of your questions. Here, Phil Haack uses square brackets in order to bind to a model that contains a list.

Dan Atkinson