Hello, When you create a form in html you should give a label to describe each input e.g.
Example 1
But what if you are presenting data in a table about something that is editable; does that require labels? e.g.HTML Code:<h1>Tell us about you</h1> <form method="post" action="example.html"> <p> <label for="yourname">Please enter your name</label> <input type="text" name="yourname" id="yourname" /> <input type="submit" value="Submit Data" /> </p> </form>
Example 2 (without labels)
orHTML Code:<h1>Employee Information</h1> <h2>Joe Bloggs</h2> <form method="post" action="example.html"> <table summary="Joe Bloggs Employment Details"> <tbody> <tr> <th scope="row">Hours Per Week</th> <td> <input type="text" name="hoursperweek" value="40"> </td> <th scope="row">Salary</th> <td> <input type="text" name="salary" value="25000"> </td> </tr> </tbody> </table> <input type="submit" value="Change Details" /> </form>
Example 3 (with labels)
Which is correct? or are they both incorrect?HTML Code:<h1>Employee Information</h1> <h2>Joe Bloggs</h2> <form method="post" action="example.html"> <table summary="Joe Bloggs Employment Details"> <tbody> <tr> <th scope="row">Hours Worked Per Week</th> <td> <label for="hoursperweek">Hours Worked Per Week</label> <input type="text" name="hoursperweek" id="hoursperweek" value="40"> </td> <th scope="row">Salary (GBP)</th> <td> <label for="salary">Salary (GBP)</label> <input type="text" name="salary" id="salary" value="25000"> </td> </tr> </tbody> </table> <input type="submit" value="Change Details" /> </form>
Thanks
ro0bear![]()








Bookmarks