Okay, I have a series of files that essentially creates 5 php files for a program I am writing. It currently writes 4 of the needed files and I’m about to start on the fifth. However, I’ve come to the realization of a problem. The originating file creates dynamic inputs based on the users original input. If they enter say ‘7’ for the number of fields, this will create 7 subsets of 3 inputs which will allow them to input the name (first input) of the type (second input) of an entry field and then enter the size (third input) of the entry field. So if they enter 7 they will have 7 sets of inputs, each allowing them to enter Name, Type and Size. If these fields are then entered as [I]item_number, text, 15
[CODE]
<input type=’text’ name=’item_number’ size=’15’>
Hope this is making sense so far.
So in each of my 4 files, I’ve only been concerned with the name entered but this final file will have to include all 3 as this will be the file created for final user input. My previous entries have been declared by foreach($_POST[‘name’] as $value) and then I can go from there. However, since I will actually have to pull all of these without knowing how many fields the user has selected, how should I do this? The originating file writes this code for the number of entries, $i, the user has input.
[CODE]
for ($i=1;$i<=$number_of_fields;$i++)
{
print “<tr><td height=17 bgcolor=’#7E7C53′ colspan=3 align=center><font class=’title’>Input #$i</font></td></tr>n”;
print “<tr><td colspan=3 height=10></td></tr>n”;
print “<tr><td align=center><input type=’text’ name=’name[$i]’ size=’15’></td>n”;
print “<td align=center><select name=’field_type[$i]’><option value=”></option><option value=’text’>Text</option><option value=’textarea’>Text Area</option><option value=’hidden’>Hidden</option></td>n”;
print “<td align=center><input type=’text’ name=’size[$i]’ size=’5′></td></tr>n”;
print “<tr><td align=center>Field Name</td><td align=center>Field Type</td><td align=center>Size</td></tr>n”;
print “<tr><td colspan=3 height=10></td></tr>n”;
}