PHP-Code:
$records = "(".$value.",".$_POST["LfdNr"][$key].",".( !empty($_POST["box"][$key]) ? "1" : "0" ).")";
$records = "(".$value.",".$_POST["LfdNr"][$key].",".( !empty($_POST["box"][$key]) ? "1" : "0" ).")";
echo "<pre>";
print_r($_POST['box']);
echo "</pre>";
Array
(
[0] => 1
[1] => 1
[2] => 1
)
Array
(
[0] => 1
[1] => 1
[2] => 1
)
Array
(
[0] => 1
[1] => 1
[2] => 1
)
Array
(
[0] => 1
[1] => 1
[2] => 1
)
Array
(
[0] => 1
[1] => 1
[2] => 1
)
Array
(
[0] => 1
[1] => 1
[2] => 1
)
Array
(
[0] => 1
[1] => 1
[2] => 1
)
Array
(
[0] => 1
[1] => 1
[2] => 1
)
Array
(
[0] => 1
[1] => 1
[2] => 1
)
Array
(
[0] => 1
[1] => 1
[2] => 1
)
Array
(
[0] => 1
[1] => 1
[2] => 1
)
Array
(
[0] => 1
[1] => 1
[2] => 1
)
Array
(
[0] => 1
[1] => 1
[2] => 1
)
foreach ( $_POST["Fonds"] AS $key=>$value )
{
echo isset($_POST["box"][$key]) ? "1" : "0" ;
}
$i=0;
while ($line=mysql_fetch_array($result1)) {
echo '<tr><td>'.$line['lfd_nr'].'</td>
<td>
<INPUT type="hidden" name="Fonds[$i][]" value='.$line['FondsNr'].'>
<INPUT type="hidden" name="LfdNr[$i][]" value='.$line['lfd_nr'].'>
<INPUT type="checkbox" name="box[$i][]" value="1" '.($line['status']==1 ? " checked" : "").'></td></tr>';
$i++;
}
while ($line=mysql_fetch_array($result1)) {
echo '<tr><td>'.$line['lfd_nr'].'</td>
<td>
<INPUT type="hidden" name="Fonds[]" value='.$line['FondsNr'].'>
<INPUT type="hidden" name="LfdNr[]" value='.$line['lfd_nr'].'>
<INPUT type="checkbox" name="box['.$line['lfd_nr'].']" value="1" '.($line['status']==1 ? " checked" : "").'></td></tr>';
}
EDIT:
sorry, ich hab grad das essen auf dem herd ... bin also hin- und hergerissen
foreach ($_POST['Fonds'] AS $k => $v)
{
echo ''.$v.'/';
echo ''.$_POST["LfdNr"][$k].'/';
echo ''.$_POST["box"][$k].'<br>';
}
while ($line=mysql_fetch_array($result3)) {
echo '<tr><td>'.$line['lfd_nr'].'</td>
<td>
<INPUT type="hidden" name="Fonds[]" value='.$line['FondsNr'].'>
<INPUT type="hidden" name="LfdNr[]" value='.$line['lfd_nr'].'>
<INPUT type="checkbox" name="box[]" value="1" '.($line['status']==1 ? " checked" : "").'></td></tr>';
}
echo '</table>';
?>
<input type=submit value="streichen"></form>
Kommentar