PHP allows control arrays in forms e.g. this is a counter editing script
echo "<input name=\"counterd elname[]\" type=\"hidden\" value=\"";
echo "<input name=\"countern ame[]\" type=\"hidden\"
value=\"".$name str."\">";
echo "<input name=\"newvalue[]\" size=".VALUEWID TH."
value=\"".$valu estr."\">";
echo "<input name=\"delcount er[".$namestr. "]\" type=\"checkbox \">";
The resultant web page might look something like this, in part:
<td><font face="arial,hel vetica" size=2><input
name="delcounte r[www.mysite.co.n z:]" type="checkbox" ></font></td>
<tr><td><font face="arial,hel vetica" size=2><input name="counterna me[]"
type="hidden"
value="www.mysi te.co.nz:/20040313/index.shtml">www.mysite.co.nz:/20040313
/index.shtml</font></td>
Control arrays in PHP offer significant advantages in processing form
input where there are a variable number of sets of the same elements
repeated multiple times down the page to allow a set of records of the
same data fields to be edited. The form elements are received back in the
processing script as an array which can be dealt with in a
straightforward for loop.
According to HTML 4.0 standards, the name of an Input element should
follow these conventions:
"NAME tokens must begin with a letter ([A-Za-z]) and may be followed by
any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"),
colons (":"), and periods (".")."
I don't see anything there about the square brackets which are part of
the PHP array syntax, but they seem to be accepted and PHP seems to be
able to turn all the elements it receives into an array on the submission
of the form to the processing script. Is there something in the CGI
conventions or HTML that it does permit this syntax?