Skip to content

Instantly share code, notes, and snippets.

@jlamim
Last active April 28, 2016 03:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jlamim/915460887821f6f85523ba0feb9e883c to your computer and use it in GitHub Desktop.
Save jlamim/915460887821f6f85523ba0feb9e883c to your computer and use it in GitHub Desktop.
Importando dados CSV com CodeIgniter - View Home
<div>
<?php if (isset($error)): ?>
<div><?php echo $error; ?></div>
<?php endif; ?>
<?php if ($this->session->flashdata('success') == TRUE): ?>
<div><?php echo $this->session->flashdata('success'); ?></div>
<?php endif; ?>
<form method="post" action="<?=base_url('importar')?>" enctype="multipart/form-data">
<div>
<label>Selecione o arquivo CSV para importação:</label>
<input type="file" name="csvfile"/>
</div>
<input type="submit" value="Importar" class="btn btn-success" />
</form>
<table>
<caption>Contatos</caption>
<thead>
<tr>
<th>Nome</th>
<th>Email</th>
</tr>
</thead>
<tbody>
<?php if ($contatos == FALSE): ?>
<tr><td colspan="2">Nenhum contato encontrado</td></tr>
<?php else: ?>
<?php foreach ($contatos as $row): ?>
<tr>
<td><?php echo $row['nome']; ?></td>
<td><?php echo $row['email']; ?></td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
</tbody>
</table>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment