Help me understand the "name" attribute

I’m not quite sure I understand what it “does”.

The explanation on fCC says " In order for a form’s data to be accessed by the location specified in the action attribute, you must give the text field a name attribute and assign it a value to represent the data being submitted. For example, you could use the following syntax for an email address text field: <input type="text" name="email">. Add the name attribute with the value catphotourl to your text field."

How does “catphotourl” value connect/correlate to the action attribute? What does the text field have to do with “catphotourl”?

I’m so confused.

the action attribute specifies a ‘server’ or a computer that will read the form data you send to it.
The server needs to make sense of the data you are sending.
For eg. Let’s say you want to send 2 input fields the first and last name.
if the user types Quincy and Jones, which ones is the first name and which one is the last?
the server has no clue (it doesn’t have human eyes to see what the user is typing)
So the only way it knows is via the name attribute.
The name attribute tells the server what the name of the data is so that a programmer can sort through that data later on and store it or act on it in some way.

hope this helps

Ok, hmmm I think that kinda clears it up for me. Thank you

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.