v2.5.2
Giriş yap

Post islemi array ciktisi ile tablo

murat5858
377 defa görüntülendi

Merhaba,

bir Fatura scripti yaziyorum ama bir konuda takildim
Form Tablom su sekilde:

      <input id="input_1" type="text" placeholder="tur" name="tur[]" />
      <input id="input_2" type="text" placeholder="miktar" name="miktar[]" />
      <input id="input_2" type="text" placeholder="birim" name="birim[]" />
      <input id="input_2" type="text" placeholder="fiyat" name="fiyat[]" />
      <input id="input_2" type="text" placeholder="toplamfiyat" name="toplamfiyat[]" />

burda JQuery ile daha fazla input ekletebiliyorum ama bunlari foreach ile yapilmasi gerekdigini anladim ancak nasil tabloda tr altinda yazdirabilirim?

Su sekilde denedim ama basarili olamadim

    <table class="table">
  <thead>
    <tr>
      <th scope="col">Tür</th>
      <th scope="col">Miktar</th>
      <th scope="col">Birim</th>
      <th scope="col">Fiyat</th>
      <th scope="col">Toplam Fiyat</th>
    </tr>
  </thead>
  <tbody>
	
	<?php foreach($_POST as $row){ ?>
	<tr>
      <td><?php echo $row[0]; ?></td>
      <td><?php echo $row[1]; ?></td>
      <td><?php echo $row[2]; ?></td>
      <td><?php echo $row[3]; ?></td>
      <td><?php echo $row[4]; ?></td>
	</tr>
	<?php } ?>
	
  </tbody>
</table>
Cevap yaz
Cevaplar (1)
qplot
948 gün önce

foreach ($_POST as $key => $row){