
HTML Elements for the Body Form Controls
Names versus IDs
<p> Please c omplet e the follow i n g for m i f y ou are an u n dergrad : </p>
< form id=" formUG " a c tion =" p roce ss - c o mments. php">
< input typ e =" hidden " n ame =" l e vel" value ="UG">
< label for="c1"> Describ e your p roblem : </lab el >
< input typ e =" text " name =" commen t " id =" c1" maxleng t h ="250 " requ ired >
<br/>< input type =" submit ">
<form >
<p> Please c omplet e the follow i n g for m i f y ou are a p ostgrad : </p>
< form id=" formPG " a c tion =" p roce ss - c o mments. php">
< input typ e =" hidden " n ame =" l e vel" value ="PG">
< label for="c2"> Describ e your p roblem : </lab el >
< input typ e =" text " name =" commen t " id =" c2" maxleng t h ="250 " requ ired >
<br/>< input type =" submit ">
</ form >
<p>
Help :<br / >
If y ou are an u n d ergraduat e stud ent ,
compl e t e < a h ref ="# c1"> the firs t form </a>. <br />
If y ou are a p o s tgradua t e stu d ent ,
compl e t e < a h ref ="# c2"> the secon d form </a>.
</ p >
•
Entering ‘None’ into the second form and activating the submit button
sends level=PG and comment=None to process-comments.php
•
Activating the hyperlink underlying ‘the second form’ focuses input on
the form with id c2
; name and id serve different purposes
still, programmers often use the same value for both
unless this is not possible (as in the example above)
COMP519 Web Programming Lecture 9 Slide L9 – 12