Jump to content
Fórum Script Brasil
  • 0

Tela de Pesquisa


Fabiano Almeida

Question

ola bom dia

bom dia , gostaria de saber como faço quando o usuario estiver em um input que solicite o codigo por ex. (de um banco) e ele não saiba ele clique em um botao digita em uma caixa de texto o nome que ele quer pesquisar , ele mostre as ocorrencias encontradas então clique no nome desejado e retorne o valor para o campo input

já tentei de varias maneiras

obs. a tela de consulta conseguir fazer pra pesquisar

Exemplo

//**************************************** lancamento de proposta *******************************

Cod. Banco : aqui aparecer um link para abrir a tela de pesquisar , conforme ele selecionar me retorne o codigo pra esse mesmo campo

/********************************* a tela de pesquisa e essa

<?php

include "firebirdconfig.inc";

?>

<html>

<head>

<title>Consulta Cadastros </title>

&lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>

&lt;script language="JavaScript" src="js/jquery.tablesorter.js"></script>

&lt;script language="JavaScript" src="js/jquery.tablesorter.pager.js"></script>

<link rel="stylesheet" href="Css/custom.css" media="screen" />

</head>

<body bgcolor="#FFFFFF" text="#000000">

<form name="frm_pesq" action="<?php echo $_SERVER['PHP_SELF']; ?>?acao=pesquisar" method=POST">

<p>

<label for="pesquisar">Pesquisar</label>

<input type="text" id="dado" name="dado" size="30" />

<input type="submit" name="pesquisar" value= "Pesquisar"/>

</p>

</form>

<?php

if($_REQUEST['acao] == "pesquisar")

{

$dado = $_POST["dado"];

$dado = '%' . $dado . '%';

$sql_consultar = "SELECT CODIGO, DESCRICAO FROM BANCOS

WHERE UPPER(DESCRICAO) LIKE UPPER('$dado') ORDER BY DESCRICAO";

// New Dbug($sql_consultar);

$consultar_resultado = ibase_query($conexao,$sql_consultar) or die("Erro no SQL: ".ibase_errmsg());

?>

<table cellpadding=0" class="tablesorter">

<thead>

<tr>

<th><?php echo 'Codigo'; ?></th>

<th><? echo 'Descricao'; ?></th>

</tr>

</thead>

<tbody>

<?php while ($array_dados = ibase_fetch_object($consultar_resultado)) {?>

<tr>

<td><?php print $array_dados->CODIGO; ?></td>

<td><?php print $array_dados->DESCRICAO; ?></td>

</tr>

<tr>

<?php }

}

?>

</tbody>

</table>

<div id="pager" class="pager">

<form>

<img src="imagens/first.png" class="first"/>

<img src="imagens/prev.png" class="prev"/>

<input type="text" class="pagedisplay"/>

<img src="imagens/next.png" class="next"/>

<img src="imagens/last.png" class="last"/>

<select class="pagesize">

<option selected="selected" value="10">10</option>

<option value="20">20</option>

<option value="30">30</option>

<option value="40">40</option>

</select>

</form>

</div>

&lt;script>

$("table")

.tablesorter({widthFixed: true, widgets: ['zebra]})

.tablesorterPager({container: $("#pager")});

.tablesorter( {sortList: [[0,0], [1,0]]} );

});

</script>

</body>

</html>

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Tarde,

cara montei um exemplo aqui, acho que pode te ajuda.

index.php

<html>
    <head>     
        <script language="javascript">

            var popup;

            function Abrir_JanelA(UrL){

                popup = window.open(UrL, "Consulta", "width=400px,height=400px");

            }
        </script>
    </head>
    <body>
        <a href="java script:Abrir_JanelA('consulta.php')">Pesquisar</a>
        <input type="text" name="recebe" id="recebe"/>
        <br/>       
    </body>
</html>
consulta.php
<html>
    <head>
        <script type="text/javascript">
            function passa_valor(){
                
                var pai = window.opener;                                 
                var passa = document.getElementById("passa");
                
                pai.document.getElementById("recebe").value = passa.value;
                
                window.close();
            }
        </script>
    </head>
    <body>
        
        <input type="text" name="passa" id="passa"/>
        <input type="button" value="Passa valor" onclick="passa_valor();"/>
       
    </body>
</html>

Referência do exemplo

T+

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      652k
×
×
  • Create New...