Jump to content

Recommended Posts

Posted

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

Posted

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.

Posted

Generaly name attribute specifies the name of an <input> element.and type attribute specifies the type of <input> element to display.Name attribute is used to retrieve the value of the control by the server side script that processes the form.

  • 3 weeks later...
Posted

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...