bir formumda hiç hata yokken böyle birşey görür oldum, hatayı veriyor ama yine de insert oluyor. Ne olabilir? Hatayı aşağıdaki foreach den sonra $emkod = $_POST['mkod'][$i]; için alıyorum. Ne olabilir?
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "recete")) {
$i=0;
foreach ($_POST as $val) {
$eskod = $_POST['skod'];
$emkod = $_POST['mkod'][$i]; // HATAYI BU SATIR İÇİN ALIYORUM
$birim= $_POST['birim'][$i];
$mikktar = $_POST['miktar'][$i];
$kimsin = $_SESSION['MM_Username'];
if($emkod != "") {
$insertSQL = mysql_query("INSERT INTO urunrecete (stokkod, malkodu, birim, miktar, username)
VALUES ('$eskod','$emkod','$birim','$mikktar','$kimsin')");
$i++;
}
}
<form method="POST" action="<?php echo $editFormAction; ?>" name="recete" id="recete">
<table class="table-responsive table-bordered table-condensed">
<tbody>
<tr>
<td>Stok Kodu</td>
<td><input type="text" class="form-control" name="skod" id="skod"></td>
<td><input type="text" name="adi" class="form-control" disabled></td>
<td><input type="submit" class="btn btn-success" value="Kaydet"></td>
</tr>
</tbody>
</table>
<table class="table-condensed table-bordered table-responsive" id="urunrecete">
<thead>
<tr>
<th align="center">Stok Kodu</th>
<th align="center">Stok Tanım</th>
<th align="center">Birim</th>
<th align="center">Miktar</th>
</tr>
</thead>
<tbody>
<tr>
<td><input type="text" class="form-control" name="mkod[]" id="mkod" required></td>
<td><input type="text" class="form-control" name="mtanim[]" id="mtanim" disabled></td>
<td><input type="text" class="form-control" name="birim[]" id="birim" required></td>
<td><input type="text" class="form-control" name="miktar[]" id="miktar" required></td>
<td align="center"><a href="javascript:void(0);" class="addCF">Satır Ekle</a></td>
</tr>
</tbody>
</table>
<input type="hidden" name="MM_insert" value="recete">
</form>