The label has 2 main functions: identify to the HTML what the label is for, and in most common browsers clicking the label will set the focus to the input. Below are the possible scenarios. Keep in mind it's usually easiest to set both the id and name of the input to the same value.
Will not link label to input:
<label for="myInput">My Input</label>
<input name="myInput">
Will not send form data to server (custom-built AJAX objects that include by id are an exception):
<label for="myInput">My Input</label>
<input id="myInput">
Also will not link label to input (for needs to be id, not name):
<label for="input">My Input</label>
<input name="input" id="myInput">
Correct:
<label for="myInput">My Input</label>
<input name="myInput" id="myInput">
Also correct with non-matching name/id:
<label for="myInput">My Input</label>
<input name="input" id="myInput">