I'm trying to figure out how to design a form that will eventually be used to calculate a semester gpa for a homework assignment. This form consists of 5 blocks of three text fieds (One to enter a course name, one to enter a letter grade and one to enter what gpa the student got in the class). Even though there's five rows are on the form, but the user doesn't need to enter info for all for rows. Here's how my code looks like so far for the form:
function createGPACalcForm($infoblocks,$textfieldwidth)
{
for($count=0;$count<$infoblocks;$count+=1)
{
echo <<<HW_5_PART_TWO_TABLE
<tr>
<td><input type="text" name="course[]" /></td>
<td><input type="text" name="units[]" size="$textfieldwidth" /></td>
<td><input type="text" name="letterGrade[]" size="$textfieldwidth" /></td>
</tr>
HW_5_PART_TWO_TABLE;
}
}
My problem is that my teacher doesn't use "[]" in the names of the textfield box. Instead he puts a number after each name and his demo program works. Wouldn't it be better to use "[]" in the text box field names in this case or is there a better way to do this?