0
On my page there are fields that are tabulated data, where the user must select an existing data in the table
For simple case, I’m using the <select><option>
of html
fed a table reading via php
, but I came across a case where the data of a table is many. With this the combo gets too big and the page gets heavy to load.
I would like to know how to insert a kind of button that calls a dialog
which will display the table with the values, where the user can click on the data and this be sent to the form
.
$(Function() { $( "#datepicker" ).datepicker(); }); $(Function() { $( "#tabs" ).tabs(); });
<?php
require_once('../../function/funcoes.php');
?>
</head>
<title>Dober System</title>
<body>
<div id="container">
<form action="../../function/funcoes.php"" name="inserir_C" id="inserir_C" method="POST">
<div id="Cliente">
<fieldset id="Cliente">
<legend><b>Dados Gerais: </b></legend>
<label for="CODIGO">
Código:<input type="text" name="CODIGO" id="CODIGO" MAXLENGTH="4" value="" onKeyUp="javascript:somente_numero(this);" required/>
</label>
<label for="NOME">
Nome:<input name="NOME" id="NOME" MAXLENGTH="50" value="" />
</label>
<label for="NOMEABR">
Nome Abreviado:<input name="NOMEABR" id="NOMEABR" MAXLENGTH="20" value="" />
</label>
<label for="GRUPO">
Grupo:
<?php
$rs = mysql_query("SELECT ID,DESCRICAO FROM FINANCEIRO.GRUPO ORDER BY ID");
montaCombo('GRP_cmb', $rs, 'ID', 'DESCRICAO',null);
?>
</label>
<label for="REPRES">
Representante:
<?php
$rs = mysql_query("SELECT CODIGO,ID FROM FINANCEIRO.REPRESENTANTE ORDER BY CODIGO");
montaCombo('REPRE_cmb', $rs, 'CODIGO', 'ID',null);
?>
</label>
<label for="TRANSP">
Transportadora:
<?php
$rs = mysql_query("SELECT CODIGO,NOME FROM FINANCEIRO.TRANSPORTADORA ORDER BY CODIGO");
montaCombo('TRANSP_cmb', $rs, 'CODIGO', 'NOME',null);
?>
</label>
<!--<label for="DATA">
Data Implant.:<input type="text" name="DATA" id="datepicker" MAXLENGTH="10" value="" />
</label>-->
</fieldset>
</div>
</div>
</body>
</html>
function montaCombo($nome, $rs, $valor, $descricao,$cmb)
{
echo("<select name='$nome' class='styled-select'>");
echo("<option selected='selected'></option>");
while ($obj = mysql_fetch_object($rs))
{
echo("t<option value='".$obj->$valor."' > ".$obj->$valor.":". $obj->$descricao." </option>");
}
if(!$cmb==null)
{
$row = mysql_fetch_array($cmb);
$a= $row[$valor];
$b=$row[$descricao];
echo ("<option value=\"$a\" selected>$a:$b</option></select>");
}else
{
echo ("</select>");
}
}
You should enter the form code and php q code creates the table
– Wpbarcelos
Thiago, that dit that is to be approved is yours?
– Sergio