HTML and CSS Reference
In-Depth Information
Stop right there. Do you
think I didn't see the way
you slipped in that element name
of “extras[]”? What's with those
square brackets! You have to
explain that.
Believe it or not, “extras[]”
is a perfectly valid name for
a form element.
But even if it's valid , it doesn't exactly look
normal , does it? Here's the deal: from the
perspective of HTML, this is a normal form
element name; it doesn't have any effect on
the browser at all if it has square brackets in
the name.
So why did we use them? It turns out that the
scripting language that the “processorder.php”
server script is written in (PHP) likes a little
hint that a form variable may have multiple
values in it. The way you give it this hint is to
add “[ ]” on the end of the name.
So, from the perspective of learning HTML,
you can pretty much forget about all this, but
you might just tuck this into the back of your
mind in case you ever write a form that uses a
PHP server script in the future.
Search WWH ::

Custom Search