Skip to content

Instantly share code, notes, and snippets.

@jokosusilo
Created July 25, 2018 13:21
Show Gist options
  • Save jokosusilo/7d9d36d3e5d9e62e9815bb2d6b6e29ce to your computer and use it in GitHub Desktop.
Save jokosusilo/7d9d36d3e5d9e62e9815bb2d6b6e29ce to your computer and use it in GitHub Desktop.
Search Customer
public function tiket()
{
$this->load->helper('url');
$this->load->model('m_customer');
$query = $this->input->get('query');
$data = array(
'customer' => array()
);
if ($query) {
$data = array(
'customer' => $this->m_customer->getCustomerByQuery($query)
);
}
$this->load->view('welcome_message', $data);
}
<div>
<form action="<?php echo site_url('welcome/tiket') ?>" method="GET">
<input type="text" name="query">
<input type="submit">
</form>
<?php if ($customer): ?>
<div>
<table>
<thead>
<tr>
<th>No</th>
<th>Nama</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php foreach ($customer as $index => $item): ?>
<tr>
<td><?php echo ($index+1) ?></td>
<td><?php echo $item['nama'] ?></td>
<td><a href="<?php echo site_url('showCustomer/') ?>">📝</a></td>
</tr>
<?php endforeach ?>
</tbody>
</table>
</div>
<?php endif ?>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment