I want to display a group of fields in TCPDF. I can display them by this code (without TCPDF) :
<?php $i = 1; ?>
<?php foreach ( $group as $v) : ?>
<tr>
<br>
<td style = "widht:20%">Tahun : </td>
<td style = "width:20%"><?= $v['tahun']; ?></td>
<br>
<td style = "widht:20%">Kegiatan : </td>
<td style = "width:20%"><?= $v['kegiatan']; ?></td>
<br>
<td style = "widht:20%">Lokasi : </td>
<td style = "width:20%"><?= $v['lokasi']; ?></td>
</tr>
<?php $i ; ?>
<?php endforeach; ?>
<br><br>
but I get error ' Undefined array key "startcolumn" ' in TCPDF (report.php) :
<?php $i = 1; ?>
<?php foreach ( $group as $v) : ?>
<tr>
<tr>
<td style = "widht:20%">Tahun : </td>
<td style = "width:20%"><?= $v['tahun']; ?></td>
<tr>
<td style = "widht:20%">Kegiatan : </td>
<td style = "width:20%"><?= $v['kegiatan']; ?></td>
<tr>
<td style = "widht:20%">Lokasi : </td>
<td style = "width:20%"><?= $v['lokasi']; ?></td>
</tr>
<?php $i ; ?>
<?php endforeach; ?>
<tr><tr>
Could anybody help me, please ?
CodePudding user response:
This is my complete report.php
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laporan</title>
</head>
<style>
.tabel {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
border-collapse: collapse;
}
.tabel td {
border-style:ridge;
}
</style>
<body>
<h1 style="text-align:center;">DAFTAR RIWAYAT HIDUP</h1>
<form action="<?= route_to('laporan', $result['id']) ?>" method="post"><tr>
<table >
<colgroup>
<col span="1" style="width: 40%;">
<col span="1" style="width: 2%;">
<col span="1" style="width: 50%;">
</colgroup>
<tbody>
<tr>
<td style = "width:40%">1.Posisi yang diusulkan</td>
<td style = "width:2%">:</td>
<td style = "width:50%"><?= $result['posisi'] ?></td>
</tr>
<tr>
<td style = "width:40%">2.Nama Perusahaan</td>
<td style = "width:2%">:</td>
<td style = "width:50%"><?= $result['perusahaan'] ?></td>
</tr>
<tr>
<td style = "width:40%">3.Nama Personil</td>
<td style = "width:2%">:</td>
<td style = "width:50%"><?= $result['nama'] ?></td>
</tr>
<tr>
<td style = "width:40%">4.Tempat/tgl.lahir</td>
<td style = "width:2%">:</td>
<td style = "width:50%"><?= $result['ttl'] ?></td>
</tr>
<tr>
<td style = "width:40%;">5.No. NPWP</td>
<td style = "width:2%; border:none">:</td>
<td style = "width:50%; border:none"><?= $result['no_npwp'] ?></td>
</tr>
<tr>
<td style = "width:40%">6.No. Telp.</td>
<td style = "width:2%">:</td>
<td style = "width:50%"><?= $result['no_telp'] ?></td>
</tr>
<tr>
<td style = "width:40%">7. Pendidikan : </td>
</tr>
<tr>
<td style = "width:40%"> -Jurusan Pendidikan</td>
<td style = "width:2%">:</td>
<td style = "width:50%"> <?= $result['ijazahS1'] ?></td>
</tr>
<tr>
<td style = "width:40%"> -Tempat/Universitas</td>
<td style = "width:2%">:</td>
<td style = "width:50%"> <?= $result['s1_univ'] ?></td>
</tr>
<tr>
<td style = "width:40%"> -Tahun Tamat/Lulus</td>
<td style = "width:2%">:</td>
<td style = "width:50%"> <?= $result['s1_thn'] ?></td>
</tr>
<tr>
<td style = "width:40%"> -Jurusan Pendidikan</td>
<td style = "width:2%">:</td>
<td style = "width:50%"> <?= $result['ijazahS2'] ?></td>
</tr>
<tr>
<td style = "width:40%"> -Tempat/Universitas</td>
<td style = "width:2%">:</td>
<td style = "width:50%"> <?= $result['s2_univ'] ?></td>
</tr>
<tr>
<td style = "width:40%"> -Tahun Tamat/Lulus</td>
<td style = "width:2%">:</td>
<td style = "width:50%"> <?= $result['s2_thn'] ?></td>
</tr>
<tr>
<td style = "width:40%"> -Jurusan Pendidikan</td>
<td style = "width:2%">:</td>
<td style = "width:50%"> <?= $result['ijazahS3'] ?></td>
</tr>
<tr>
<td style = "width:40%"> -Tempat/Universitas</td>
<td style = "width:2%">:</td>
<td style = "width:50%"> <?= $result['s3_univ'] ?></td>
</tr>
<tr>
<td style = "width:40%"> -Tahun Tamat/Lulus</td>
<td style = "width:2%">:</td>
<td style = "width:50%"> <?= $result['s3_thn'] ?></td>
</tr>
<tr>
<tr>
<label class = "col-sm-2 col-form-label" style="width: 20px;">Pengalaman</label>
<tr>
<?php $i = 1; ?>
<?php foreach ( $group as $v) : ?>
<tr>
<tr>
<td style = "widht:20%">Tahun : </td>
<td style = "width:20%"><?= $v['tahun']; ?></td>
<tr>
<td style = "widht:20%">Kegiatan : </td>
<td style = "width:20%"><?= $v['kegiatan']; ?></td>
<tr>
<td style = "widht:20%">Lokasi : </td>
<td style = "width:20%"><?= $v['lokasi']; ?></td>
<tr>
<td style = "widht:20%">Pengguna : </td>
<td style = "width:20%"><?= $v['pengguna']; ?></td>
<tr>
<td style = "widht:20%">Perusahaan : </td>
<td style = "width:20%"><?= $v['perusahaan']; ?></td>
<tr>
<td style = "widht:20%">Posisi : </td>
<td style = "width:20%"><?= $v['posisi']; ?></td>
<tr>
<td style = "widht:20%">Referensi : </td>
<td style = "width:20%"><?= $v['referensi']; ?></td>
<tr>
<td style = "widht:20%">Status : </td>
<td style = "width:20%"><?= $v['status']; ?></td>
<tr>
<td style = "widht:20%">Uraian : </td>
<td style = "width:20%"><?= $v['uraian']; ?></td>
<tr>
<td style = "widht:20%">Waktu : </td>
<td style = "width:20%"><?= $v['waktu']; ?></td>
<tr>
</tr>
<?php $i ; ?>
<?php endforeach; ?>
<tr><tr>
</tbody>
</table>
</form>
</body>
</html>
CodePudding user response:
I found the problem, just add this code to jump to the new line
<tr><td></td></tr>