Jump to content

HTML Basic Tutorial - Forms: what is name="" for?


Recommended Posts

The HTML Basic Forms chapter:Can you break down some attributes for me, I don't understand their purpose?All the forms (drop-box, text field, radio, checkbox, etc.): NAME attributeI don't understand the purpose of the name attribute- it does not appear anywhere on the form- is it related to the server-side (different tutorial/later chapter)?- are small letters mandatory?- can I omit it?Radio/Checkbox forms: VALUE attribueWhy these 2 forms need a value attribute?- it does not give any special indication on screen- is it related to the server-side (different tutorial/later chapter)- are small letters mandatory?- can I omit it?Thanks

Link to post
Share on other sites

As you guessed, the name attribute is used in server side languages to access the value of a form element. For example, if you are using PHP as your server side language and you have a form with action="get" and with an input for a user's postcode with name="postcode", in your PHP script you can get the value of that input using $_GET["postcode"]. You will get to that in due time, I'm sure.Edit: you can use capitals if you want, and you can omit it if you know you won't want to retrieve the values in a script later on. It's worth adding unless you have pretty severe document size restrictions.

Edited by chibineku
Link to post
Share on other sites
As you guessed, the name attribute is used in server side languages to access the value of a form element. For example, if you are using PHP as your server side language and you have a form with action="get" and with an input for a user's postcode with name="postcode", in your PHP script you can get the value of that input using $_GET["postcode"]. You will get to that in due time, I'm sure.
First question cleared, thank you chibineku.What about Radio/Checkbox forms: VALUE attribute? anyone
Link to post
Share on other sites

I don't think a DTD (the document that says what's allowed in HTML) can specify the applicability of attributes based on other attributes. So, since some types of the input element use the value attribute, they all have it. However, it is not necessary.As for casing, in the attribute's value, you can have any case you want, however, if you use XHTML, then the attribute name (e.g. value) must be in lowercase, along with all other syntactic sequences. This is not so for HTML.

Link to post
Share on other sites
As for casing, in the attribute's value, you can have any case you want, however, if you use XHTML, then the attribute name (e.g. value) must be in lowercase, along with all other syntactic sequences. This is not so for HTML.
I will sure keep this in mind, XHTML tutorial come just after the HTML tutorial and before the CSS tutorial.Out of topic: can you change the default font or the board? Your answer has a (e.g. |font="courier"|text|/font|) but the board uses simple text on my end. I don't see an font selection in the board settings either? Thanks. Edited by nomnex
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...