<form method="POST" class="search_func" id="search_func" name="search_func" action="exclui_func.php"> <table> <tr> <td><span>Funcionário: </span></td> <td><input type="text" id="name_search" name="name_search"></td> <td><input type="submit" value="Buscar" class="button"></td> </tr> </table> </form> <?php } ?> <?php if (isset($_POST['name_search']) && $_POST['name_search'] != "") { $func = new Funcionario(); $funcs = $func->get_func_by_name($_POST['name_search']); if (count($funcs) > 0) { echo '<table class="exibe-pesquisa">'; foreach ($funcs as $key => $func) { echo '<tr> <td><a class=\'icon_excluir\' title=\'Clique para excluir\' onclick="excluir(' . $funcs[$key][0] . ')">' . $funcs[$key][0] . " " . $funcs[$key][1] . '</a></td></tr>'; } echo '</table>'; } } ?> </div> </div> </div> </body>
<div class="formulario"> <div class="title-box" style="float:left"><div style="float:left"><img src="../images/search-icon.png" width="35px"></div><div style="float:left; margin-top:10px; margin-left:10px;"><span class="title">Pesquisar Funcionario</span></div></div> <form method="POST" class="pesquisa-campos" id="pesquisa-campos" name="pesquisa-campos" action="pesquisa_func.php"> <table id="table-search"> <tr> <td><span>Funcionario Nome: </span></td> <td><input style="width:100%" type="text" id="name_search" name="name_search" placeholder="Pesquise em branco para todos os registros."></td> <td><input type="submit" class="button" value="Buscar"></td> </tr> </table> </form> <?php if (isset($_POST['name_search'])) { $func = new Funcionario(); $funcs = $func->get_func_by_name($_POST['name_search'], $_SESSION['id_empresa']); echo '<table class="exibe-pesquisa">'; echo '<tr><td>ID</td><td>Nome</td></tr>'; $aux = 0; if (count($funcs) > 0) { foreach ($funcs as $key => $func) { if ($aux % 2 == 0) { echo '<tr style="background-color:#bbb">'; } else { echo '<tr style="background-color:#cbcbcb">'; } echo '<td><a href="pesquisa_func.php?verificador=1&id=' . $funcs[$key][0] . '">' . $funcs[$key][0] . '</a></td><td><a href="pesquisa_func.php?verificador=1&id=' . $funcs[$key][0] . '">' . $funcs[$key][1] . '</a></td> </tr>'; $aux++; } }