function main_manage_maps() { $pdo = new PDO2(); $conn = $pdo->conn(); if (isset($_POST['endereco']) && isset($_POST['action']) == 'add') { $get = $_POST; $message = $pdo->insert($conn, $get); if ($message != '') { echo $message = "<h1>Inserido com sucesso</h1>"; } else { echo $message; } } else { if ($_GET['action'] == 'delete') { $pdo->delete($_GET['id'], $conn); echo "<h1>Deletado com sucesso</h1>"; } } echo "\n <h1>Cadastro de Endereços</h1>\n <form action='admin.php?page=manage-maps' method='post'>\n <div class='admin_manage_maps'>\n <table>\n <tr>\n <th>Cep</th>\n <th>Endereço</th>\n <th>Numero</th>\n </tr>\n <tr>\n <td><input type='text' value='' name='cep'/></td>\n <td><input type='text' value='' name='endereco'/></td>\n <td><input type='text' value='' name='numero' /></td>\n </tr>\n <tr>\n <th>Bairro</th>\n <th>Cidade</th>\n <th>Estado</th>\n </tr>\n <tr>\n <td><input type='text' value='' name='bairro' /></td>\n <td><input type='text' value='' name='cidade' /></td>\n <td><input type='text' value='' name='estado'/></td>\n </tr>\n <tr>\n <td><input type='submit' value='Cadastrar'/></td>\n <input type='hidden' name='action' value='add' />\n <input type='hidden' name='page' value='manage-maps' />\n </tr>\n </table>\n </div>\n </form>\n "; //show list data in base $object = $pdo->showlist($conn); ?> <table width='100%'> <tr> <th>Cep</th> <th>Endereço</th> <th>Número</th> <th>Bairro</th> <th>Cidade</th> <th>Estado</th> <th>Deletar</th> </tr> <?php while ($data = mysql_fetch_array($object)) { ?> <tr> <td class="row-title"><?php echo utf8_decode($data['cep']); ?> </td> <td class="row-title"><?php echo utf8_decode($data['endereco']); ?> </td> <td class="row-title"><?php echo utf8_decode($data['numero']); ?> </td> <td class="row-title"><?php echo utf8_decode($data['bairro']); ?> </td> <td class="row-title"><?php echo utf8_decode($data['cidade']); ?> </td> <td class="row-title"><?php echo utf8_decode($data['estado']); ?> </td> <td class="row-title"><a href='admin.php?page=manage-maps&action=delete&id=<?php echo utf8_decode($data['id']); ?> '>[X]</a></td> </tr> <?php } //endwhile echo "</table>"; }