Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 2 of 2 FirstFirst 12
Results 16 to 17 of 17
  1. #16
    Senior Coder
    Join Date
    Apr 2011
    Location
    London, England
    Posts
    2,120
    Thanks
    15
    Thanked 354 Times in 353 Posts
    Code:
    <br/>Email Address: <br /> &nbsp; <input type="text" id="email"> <br />
    id= should be name= to make your code fragment work. Personally I tend to use both id and name and give them the same value (except for grouped elements - radio buttons, etc.. - because ids must be unique).
    Last edited by AndrewGSW; 12-13-2012 at 06:45 PM.
    "I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
    Validate your HTML and CSS

  2. #17
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,171
    Thanks
    75
    Thanked 4,339 Times in 4,305 Posts
    Yep, Andrew saw it.

    Too much copy, not enough editing on my part. Should have been.
    Code:
                <br/>Email Address: <br /> &nbsp; <input type="text" name="email"> <br />
    But I disagree with Andrew: I *NEVER* give an ID to form fields unless there is some very good reason. Granted, 99% of everything I do with <form>s has to interact with server-side code, and fields without names are useless for that purpose. But even so, you don't need an ID to reference any <form> field, so why bother?

    Almost the only exception is when I use <label for="someID"> in which case of course there must be a matchind ID. But even then, I tend to use <label> with the for= property.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


 
Page 2 of 2 FirstFirst 12

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •