Hi djjjozsi
Thanks for the code. Please bear with me, some of this new territory for me.
This is, as you point out, a one dimensional array. Why doesn't $contact['packetRecd'] work in the 'value = ' ?
How do I extract the value from packetRecd_ud[%d] ? (by the way, I am actively trying to learn this. I did spent time trying to figure it out on my own, reading about arguement swapping and trying variations of $_POST['packetRecd_ud'][etc] before asking you to help.)
I also have a problem in my UPDATE code. I am using foreach. If I have a change in only the packetRecd_ud, or tournProblem_ud I can address that in an if statement. What if I have a change in both items, but not in the same record? How do I write that foreach statement ? I don't think it would take an AND or an OR modifier.
<td class="coach_left_just" ><?php echo $contact['coachLast']. ", " . $contact['coachFirst'] . " " .$contact['idTeam'] ;?></td>
<td class="cell_border"><?php echo $contact['region'] ?></td>
<td class="cell_border">
<?php printf('<input type="checkbox"
name="packetRecd_ud[%d]"
value="1"%s />' , $contact['idTeam'] ,(($contact['packetRecd']==0) ? '' : ' checked="checked"')); ?>
</td>
<td class="cell_border"><input name="Checkbox2" type="checkbox" /></td>
<td class="cell_border"><input name="Checkbox3" type="checkbox" /></td>
<td class="cell_border">
<?php echo '<input type ="text"
style="background-color: #81F7F3;"
size ="75px"
name ="tournProblem_ud[' . $contact['idTeam'] . ']"
value="' . $contact['tournProblem'] . '">'; ?>
Here's the UPDATE portion. Since I don't know how to extract the packetRecd_ud yet, obviously I've got a bad variable here
//---| UPDATE
if($_POST['submit']=="Save")
{
if ($_POST['tournProblem_ud']){
foreach($_POST['tournProblem_ud'] as $idTeam => $value)
{
$tournProblem = $_POST['tournProblem_ud'][$idTeam];
$query = "UPDATE team_info SET
tournProblem ='$tournProblem'
WHERE idTeam = '$idTeam' LIMIT 1";
mysql_query($query) or die ("Error in query: $query");
}
}elseif ($_POST['packetRecd_ud']){
$packetRecd_ud = $_POST['packetRecd_ud'][$idTeam]; // not sure how to state packet variable
$query = "UPDATE team_info SET
packetRecd ='$packetRecd_ud'
WHERE idTeam = '$idTeam' LIMIT 1";
mysql_query($query) or die ("Error in query: $query");
}
}
Thanks for your patience.