Last active
April 28, 2016 03:51
-
-
Save jlamim/915460887821f6f85523ba0feb9e883c to your computer and use it in GitHub Desktop.
Importando dados CSV com CodeIgniter - View Home
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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