perlprogramming
Programmer
I am setting up a database utility where specific engineers are assigned to various projects. Projects will be added from time to time, so it can't be hard-coded. See the code below. It simply creates a list of project names, each with its own drop-down menu with a list of engineers, allowing the user to assign all of projects a unique responsible engineer.
==========================================
print "
<form method=\"POST\" action=\"cgi/assignperson.pl\">";
<INPUT TYPE=\"hidden\" NAME=\"total\" VALUE=\"$numberofprojects\">
for ($x=0; $x < $numberofprojects; $x++) {
print "
<p>$program[$x]: <select size=\"1\" name=\"assignedperson[]\">
<option value=\"Person1\">Person1</option>
<option value=\"Person2\">Person2</option>
<option value=\"Person3\">Person3</option>
<option value=\"Person4\">Person4</option>
<option value=\"Person5\">Person5</option>
<option value=\"Person6\">Person6</option>
</select></p>
";
} # end for loop to create form drop-downs
print "
<p> </p>
<p><input type=\"submit\" value=\"Submit\" name=\"B1\"></p>
</form>";
==========================================
I understand that you can grab the value of a single parameter using a statement like this:
$total = $param{total};
How do I send and retrieve an array in a form, like the assignedperson[] array shown above? Any ideas?
==========================================
print "
<form method=\"POST\" action=\"cgi/assignperson.pl\">";
<INPUT TYPE=\"hidden\" NAME=\"total\" VALUE=\"$numberofprojects\">
for ($x=0; $x < $numberofprojects; $x++) {
print "
<p>$program[$x]: <select size=\"1\" name=\"assignedperson[]\">
<option value=\"Person1\">Person1</option>
<option value=\"Person2\">Person2</option>
<option value=\"Person3\">Person3</option>
<option value=\"Person4\">Person4</option>
<option value=\"Person5\">Person5</option>
<option value=\"Person6\">Person6</option>
</select></p>
";
} # end for loop to create form drop-downs
print "
<p> </p>
<p><input type=\"submit\" value=\"Submit\" name=\"B1\"></p>
</form>";
==========================================
I understand that you can grab the value of a single parameter using a statement like this:
$total = $param{total};
How do I send and retrieve an array in a form, like the assignedperson[] array shown above? Any ideas?