how to submit multiple identical form fields w/ php?
Posted: Tue May 26, 2009 1:05 pm
I had a page with multiple forms. I wanted one submit button to submit all the information. I was running into problems because the names of the fields were the same in all the forms. I was told putting all the information into one form and making them arrays would solve my problem. Could somebody explain to me how I would create the php to simply display the information in the code box below?
I'd like it displayed as follows:
Category | Case Number | Description | File Name | File Type
Category | Case Number | Description | File Name | File Type
I'd like it displayed as follows:
Category | Case Number | Description | File Name | File Type
Category | Case Number | Description | File Name | File Type
Code: Select all
<tr><td align="right"><b>Category:</b></td><td>
<select name="category[]">
<option value="selectone" selected>Select One</option>
<option value="category1">Category One</option>
<option value="category2">Category Two</option>
<option value="category3">Category Three</option>
</select>
</td></tr>
<tr><td align="right"><b>Case Number:</b></td><td><input name="casenumber[]" size=40></td></tr>
<tr><td align="right"><b>Description:</b></td><td><input name="description[]" size=40></td></tr>
<tr><td align="right"><b>File Name:</b></td><td><input name="filename[]" size=40></td></tr>
<tr><td align="right"><b>File Type:</b></td><td></td></tr>
<tr><td align="right"><b>Filename:</b></td><td><input type="file" name="file[]" id="file" size=50 /></td></tr>
<tr><td align="right"><b>Category:</b></td><td>
<select name="category[]">
<option value="selectone" selected>Select One</option>
<option value="category1">Category One</option>
<option value="category2">Category Two</option>
<option value="category3">Category Three</option>
</select>
</td></tr>
<tr><td align="right"><b>Case Number:</b></td><td><input name="casenumber[]" size=40></td></tr>
<tr><td align="right"><b>Description:</b></td><td><input name="description[]" size=40></td></tr>
<tr><td align="right"><b>File Name:</b></td><td><input name="filename[]" size=40></td></tr>
<tr><td align="right"><b>File Type:</b></td><td></td></tr>
<tr><td align="right"><b>Filename:</b></td><td><input type="file" name="file[]" id="file" size=50 /></td></tr>