3
I created a frame on the intranet via Wordpress (php, Mysql) to list the employee extensions of the company. By clicking on link of extensions appears a table and the scroll bar to view the list. I need to create a search field (field created but no functionality yet) on this page so that the user has the option of instead of searching for the list who he wants, he type the person’s name, click search and when doing this the table restricts only people with the name or part of the name corresponding to the typed. How do you do that? Follow me current code.
<!-- Campo para pesquisa -->
<input type="text" name="texto" placeholder="Digite a pesquisa" />
<button type="submit">Buscar</button></div><br><br>
<?php
$sql = "SELECT ramal, setor , coalesce (funcionario, setor) as funcionario FROM ramais ORDER BY funcionario asc";
$dados = mysql_query($sql);
$linha = mysql_fetch_array($dados);
?>
<table class="lista-ramais">
<?php
$ramal = ($linha['ramal']);
$setor = ($linha['setor']);
$funcionario = ($linha['funcionario']);
$classe = "";
if ( $linha['ramal'] <> " " ) { $classe=" style='background:#E0DEFE'";
echo "</table><br /><table class='lista-ramais'><tr><th " . $classe . ">Usuário</th><th " . $classe . ">Ramal</td> <th " . $classe . ">Setor</th></tr>";
while ( $linha = mysql_fetch_array($dados) ) {
echo "<tr><td align=left>" . ucwords($linha['funcionario']) . "<br /></td><td>" . ucwords($linha['ramal']) . "</td> <td>" . ucwords($linha['setor']) . "</td></tr>";
}
}
?>
</table>