HTML and CSS Reference
In-Depth Information
How form element names work
Here's the thing to know about the name attribute: it acts as the glue between your
form and the server script that processes it. Here's how this works:
Each input control in your form has a
name attribute:
When you type the elements for a form into your HTML
file, you give them unique names. You saw this with the
text and tel inputs:
N o t i c e h e re w e ' ve g o t a n e l e m e n t w h o s e
n a m e i s “ n a m e ” ( w h i c h i s pe rf e ct ly f i n e ) .
<input type="text" name="name">
<input type="text" name="address">
<input type="text" name="city">
<input type="text" name="state">
<input type="text" name="zip">
<input type="tel" name="phone">
Each <input> element
gets its own n ame.
What y ou enter into
the for m.
When you submit a form, the browser
packages up all the data using the
unique names:
Say you type your name, address, city, state, zip, and
phone into the form and click Submit. The browser takes
each of these pieces of data and labels them with your
unique name attribute values. The browser then sends
the names and values to the server. Like this:
name = Buckaroo Banzai
address = Banzai Institute
city = Los Angeles
state = CA
zip = 90050
phone = 310-555-1212
Wha t the browser p ackages
up f or the server
Search WWH ::

Custom Search