agathalatham Posted November 6, 2012 Report Share Posted November 6, 2012 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 Quote Link to comment Share on other sites More sharing options...
falkencreative Posted November 6, 2012 Report Share Posted November 6, 2012 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. Quote Link to comment Share on other sites More sharing options...
Dhanishta Posted November 7, 2012 Report Share Posted November 7, 2012 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. Quote Link to comment Share on other sites More sharing options...
emmajohnson Posted November 27, 2012 Report Share Posted November 27, 2012 <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 .. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.