ptmuldoon
04-18-2008, 07:04 PM
I'm working on creating a back-end Admin form of the a current Games Settings, Players, etc. The Admin can then update the values in the form and resubmit the data if required.
I've created a form that will list a row for each player with all the players data. Thus, for a game, with 6 players, the form lists 6 rows of information. Each field for each row in the form is currently a text field that the Admin can update.
Can someone maybe explain how you would create the function for the form submission so it processes all of the fields in all of the rows?
The current form code looks something like below, and I've include a hidden Player ID (PID) field for possible use. Can you use a foreach or similar loop to update each players info in the form?
<form action="./admin/functions/function_admin_update_players.php" method="POST">
<table>
<tr>
<td id="create_title">PID</td>
<td id="create_title">Player</td>
<td id="create_title">Color</td>
<td id="create_title">State</td>
</tr>
<tr>
<input name="pid" type="hidden" value="1" />
<td>1</td>
<td><input name="pname" type="text" value="Player1" size="15" maxlength="32" /></td>
<td><input name="pcolor" type="text" value="green" size="15" maxlength="32" /></td>
<td><input name="pstate" type="text" value="dead" size="15" maxlength="32" /></td>
</tr>
<tr>
<input name="pid" type="hidden" value="2" />
<td>2</td>
<td><input name="pname" type="text" value="Player2" size="15" maxlength="32" /></td>
<td><input name="pcolor" type="text" value="blue" size="15" maxlength="32" /></td>
<td><input name="pstate" type="text" value="dead" size="15" maxlength="32" /></td>
</tr>
</table>
<input name="gid" type="hidden" value="482"/>
Submit: <input type="submit" name="updategame" value="Submit Changes">
<input type="reset" value="Reset Values"/>
<p>
</form>
I've created a form that will list a row for each player with all the players data. Thus, for a game, with 6 players, the form lists 6 rows of information. Each field for each row in the form is currently a text field that the Admin can update.
Can someone maybe explain how you would create the function for the form submission so it processes all of the fields in all of the rows?
The current form code looks something like below, and I've include a hidden Player ID (PID) field for possible use. Can you use a foreach or similar loop to update each players info in the form?
<form action="./admin/functions/function_admin_update_players.php" method="POST">
<table>
<tr>
<td id="create_title">PID</td>
<td id="create_title">Player</td>
<td id="create_title">Color</td>
<td id="create_title">State</td>
</tr>
<tr>
<input name="pid" type="hidden" value="1" />
<td>1</td>
<td><input name="pname" type="text" value="Player1" size="15" maxlength="32" /></td>
<td><input name="pcolor" type="text" value="green" size="15" maxlength="32" /></td>
<td><input name="pstate" type="text" value="dead" size="15" maxlength="32" /></td>
</tr>
<tr>
<input name="pid" type="hidden" value="2" />
<td>2</td>
<td><input name="pname" type="text" value="Player2" size="15" maxlength="32" /></td>
<td><input name="pcolor" type="text" value="blue" size="15" maxlength="32" /></td>
<td><input name="pstate" type="text" value="dead" size="15" maxlength="32" /></td>
</tr>
</table>
<input name="gid" type="hidden" value="482"/>
Submit: <input type="submit" name="updategame" value="Submit Changes">
<input type="reset" value="Reset Values"/>
<p>
</form>