parfaitmacaron — 2013-04-19T18:19:54-04:00 — #1
In my HTML form, I have this line:
<input type="text" name="email" id="email"/>
and in my PHP above the HTML, I have this line:
$email = mysql_real_escape_string($_POST['email']);
In the HTML, please can someone tell me the difference between name="email" and id="email"
which one is the 'email' in the PHP code taken from? name or id? Do I need both name and id?
ralphm — 2013-04-19T18:28:53-04:00 — #2
It's taken from name="".
The ID is used for associating the <label> with the <input> (assuming there is one). The <label> should have for="email" to associate it with this input. Then a user can clearly know that the label and input are directly connected.
parfaitmacaron — 2013-04-19T18:38:02-04:00 — #3
I understand! Thank you so much for answering.