Jump to content

Html Forms And Input


agathalatham

Recommended Posts

Hi! I got a question, i am a beginner and i just completed the webdesign 1 tutorial i got (very good) so i am trying to expand my knowledgements I was reading a book and i wanted to know what does it mean:

 

<form>

First name: <input type="text" name="firstname"><br>

Last name: <input type="text" name="lastname">

</form>

 

i understand: by typing First name (at the beginning of the line) that's what it is gonna be displayed on the website. the type="text" means what the user is gonna enter is text. but...what name="firstname" means??? I mean if it is already set up at the beginning of the line, what is the ROLE of this name="firstname" does it have a reason? or i simply have to learn it by memory that i have to put name="firstname" when i am trying to stablish a First Name info field?

 

The same question with this too....what is the role of name="pwd" ?

 

<form>

Password: <input type="password" name="pwd">

</form>

 

Please i would like somebody explain it to me, to get it clear.

 

Thanks

 

Maria Latham

Link to comment
Share on other sites

The "name" is a way of identifying an input field, so that you can use Javascript, PHP or another server-side language to retrieve the value of that field and find out what the user entered. You can name an input just about anything you want (there are a couple limitations -- one being that it can't include a space character), but usually it's a good idea to name it something related to its function or what input you expect in that field, so "firstname" for a field that will contain a first name, or "pwd" for a field that will contain a password.

Link to comment
Share on other sites

  • 3 weeks later...

<form>

First name: <input type="text" name="firstname"><br>

Last name: <input type="text" name="lastname">

</form>

 

for <input type="text"> that means the type of data you are going to enter is a "text type".

and in ==== (First name: <input type="text" name="firstname">) firstname is the name of that text field as you have labeled it First name.

same as last name ====(Last name: <input type="text" name="lastname">)here label is last name and name of the related text field is last name ..

to identify both the text boxes we use different names...

==========================================================================

<form>

Password: <input type="password" name="pwd">

</form>

 

here "pwd is the name of the password field (i.e. input type="password")

 

 

 

 

you can use any name you want to use ..

Link to comment
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.
Note: Your post will require moderator approval before it will be visible.

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...