Skip to content

Instantly share code, notes, and snippets.

@khannedy
Created September 23, 2011 01:52
Show Gist options
  • Select an option

  • Save khannedy/1236575 to your computer and use it in GitHub Desktop.

Select an option

Save khannedy/1236575 to your computer and use it in GitHub Desktop.
Membuat Pagination Sederhana di PHP dan Combo Box HTML 2
<table border="1">
<thead>
<tr>
<th>Employee Id</th>
<th>First name</th>
<th>Last Name</th>
</tr>
</thead>
<tbody>
<?php
foreach ($employees as $employee) {
?>
<tr>
<td><?php echo $employee->getId(); ?></td>
<td><?php echo $employee->getFirstName(); ?></td>
<td><?php echo $employee->getLastName(); ?></td>
</tr>
<?php
}
?>
</tbody>
</table>
<form method="get">
Halaman :
<select name="page" onchange="this.form.submit();">
<?php
for ($i = 1; $i <= $totalHalaman; $i++) {
?>
<option value="<?php echo $i; ?>"
<?php
if ($i == $currentPage) {
echo 'selected="selected"';
}
?>
>
<?php echo $i; ?>
</option>
<?php
}
?>
</select>
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment