I have a an online form which lists pitcher information for my child's baseball league. The form allows for multiple pitchers to be entered (an unknown quantity). I'm having problems looping through the results to get them emailed to me.
Here's the code from the form (this is for pitcher1 - up to 10 pitchers per form):
<tr bgcolor=#cfcfcf>
<td align=center><b>Team</td><td align=center><b>Pitcher Name</td>
<td align=center><b>Age</td><td align=center><b>Pitches</td></tr>
<tr>
<td><select name="pitcherteam1" size="1">
<option>PLEASE SELECT TEAM
<option>Team 1</option>
<option>Team 2</option>
<option>Team 3</option>
</select></td><td>
<input type=text size=50 name="pitcher1"></td>
<td><select name="pitcherage1" size="1">
<option>AGE
<option>8
<option>9
</select></td>
<td><input type="text" size=3 name="pitcherpitches1"></td></tr>
Here's what I have in my php email function:
$size_array = count($_POST['pitcher[]']);
for ($i=0; $i<$size_array; $i++){
$message .= <<<MESSAGE
<tr><td>$_POST['pitcherteam'][$i]</td>
<td><b>$_POST['pitcher'][$i]</td>
<td><b>$_POST['pitcherage'][$i]</b></td>
<td><b>$_POST['pitcherteam'][$i]</b></td></tr>
MESSAGE;
}
I'm hoping to loop through the form and target only rows that have a pitcher input (vs. echoing all 10 rows each time and having blank/bad data in the non-filled in fields).