I have code to make multiple checkboxes using arrays as below:
Function MakeCheckBoxes
function MakeCheckBoxes($Name,$PromptsAndValues,$Selected) {
$ArrayCount = count($PromptsAndValues);
for($Index=0;$Index<$ArrayCount;$Index++) {
$String .=<<<STRING
$PromptsAndValues[$Index]: <INPUT TYPE="CHECKBOX" NAME="$Name"
STRING;
$String .= ($ArrayCount>1) ? "[$Index]" : "";
$String .= '"';
$String .= "\n VALUE=\"$PromptsAndValues[$Index]\"";
$String .= ($Selected[$Index]) ? " CHECKED>" : ">";
$String .= "\n";
} # End of for ($Index=0;$Index<count($PromptsAndValues);$Index++)
return chop($String);
} # End of function MakeCheckBoxes ############################################
I am trying to adjust this to work with multiple text fields (I can do one, but not many). My dillema is I have multiple fields which conform to the same standards. The html is:
<tr>
<td align="right">Name:</td>
<td><input type="text" name="ref1nm" size="35"></td>
<td align="right">Phone:</td>
<td><input type="text" name="ref1ph" size="35"></td>
</tr>
<tr>
<td align="right">Relationship:</td>
<td colspan="3"><input type="text" name="ref1rel" size="70"></td>
</tr>
All of the groups that use this sturcture repeat three times, so that can be a constant. My problem has been in getting the repeat to work properly, it only wants to print one. I'm sure there's a more efficient way of doing this than what I am doing.
What I would like to do is have it set up so that each would be marked in an array...in this above html it is for job references, of which they need three. So they can be "Reference[1], Reference[2]," etc. I just can't get the array to work the way I need it to!
Does anyone have any suggestions about how I would form this code?
Thanks in advance,
Jessi