Created
April 15, 2016 23:49
-
-
Save jlamim/42f64a7884e071928fd09309c30afceb to your computer and use it in GitHub Desktop.
View Home - Criando um CRUD com CodeIgniter
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> | |
<div> | |
<h1>Criando um CRUD com CodeIgniter</h1> | |
</div> | |
<?php if ($this->session->flashdata('error') == TRUE): ?> | |
<p><?php echo $this->session->flashdata('error'); ?></p> | |
<?php endif; ?> | |
<?php if ($this->session->flashdata('success') == TRUE): ?> | |
<p><?php echo $this->session->flashdata('success'); ?></p> | |
<?php endif; ?> | |
<form method="post" action="<?=base_url('salvar')?>" enctype="multipart/form-data"> | |
<div> | |
<label>Nome:</label> | |
<input type="text" name="nome" value="<?=set_value('nome')?>" required/> | |
</div> | |
<div> | |
<label>Email:</label> | |
<input type="email" name="email" value="<?=set_value('email')?>" required/> | |
</div> | |
<div> | |
<label><em>Todos os campos são obrigatórios.</em></label> | |
<input type="submit" value="Salvar"/> | |
</div> | |
</form> | |
<div> | |
<table> | |
<caption>Contatos</caption> | |
<thead> | |
<tr> | |
<th>Nome</th> | |
<th>Email</th> | |
<th>Operações</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><?= $row['nome'] ?></td> | |
<td><?= $row['email'] ?></td> | |
<td><a href="<?= $row['editar_url'] ?>">[Editar]</a> <a href="<?= $row['excluir_url'] ?>">[Excluir]</a></td> | |
</tr> | |
<?php endforeach; ?> | |
<?php endif; ?> | |
</tbody> | |
</table> | |
</div> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment