示例#1
0
            <div class="class-form pesquisa">
               <h1>Pesquisar Empresa</h1>

                    <form method="POST" class="pesquisa-campos" id="pesquisa-campos" name="pesquisa-campos" action="pesquisa_empresa.php">
                         <table>
                           <tr>
                              <td><span >Nome Fantasia: </span>
                              <input  type="text" id="name_search" name="name_search" title="Digite o código ou a descrição para pesquisar">
                              <input class="button" type="submit" value="Buscar"></td>
                           </tr>
                        </table>
                      </form>
               <?php 
if (isset($_POST['name_search']) && $_POST['name_search'] != "") {
    $empresa = new Empresa();
    $empresas = $empresa->get_empresa_by_nome_fantasia($_POST['name_search']);
    if (count($empresas) == 0) {
        echo '<div class="msg">Nenhum registro encontrado!</div>';
    }
    if (count($empresas) > 6) {
        // exibe com scroll
        echo '<div   style="float:left; height: 200px; width:100%; overflow-x: hidden; overflow-y: scroll;">';
    }
    echo '<table class="exibe-pesquisa">';
    $aux = 0;
    foreach ($empresas as $key => $empresa) {
        if ($aux % 2 == 0) {
            echo '<tr style="background-color:rgba(230,230,230,0.8);">';
        } else {
            echo '<tr style="background-color:rgba(200,200,200,0.8);">';
        }