Carregando dados atraves do input
Pessoal
Boa noite!
Estou precisando script que ao digitar o codigo no campo input ele retorne a descrição do produto que encontra-se no BD. apos isso usuario vai lançar a informação da empresa e o valor de venda. e vai mandar enviar para o banco.
a parte que to precisando mesmo e a parte que digite o código e sistema retorna a descrição.
Alguem pode me ajudar?
Pagina index.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>PDV Mundo - Informação Mercado</title>
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="css/style.css">
<style type="text/css">
.teste {
font-size: 9px;
}
</style>
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<script type="text/javascript">/ Autor: Mario Costa /
function formatar_moeda(campo, separador_milhar, separador_decimal, tecla) {
var sep = 0;
var key = '';
var i = j = 0;
var len = len2 = 0;
var strCheck = '0123456789';
var aux = aux2 = '';
var whichCode = (window.Event) ? tecla.which : tecla.keyCode;
if (whichCode == 13) return true; // Tecla Enter
if (whichCode == 8) return true; // Tecla Delete
key = String.fromCharCode(whichCode); // Pegando o valor digitado
if (strCheck.indexOf(key) == -1) return false; // Valor inválido (não inteiro)
len = campo.value.length;
for(i = 0; i < len; i++)
if ((campo.value.charAt(i) != '0') && (campo.value.charAt(i) != separador_decimal)) break;
aux = '';
for(; i < len; i++)
if (strCheck.indexOf(campo.value.charAt(i))!=-1) aux += campo.value.charAt(i);
aux += key;
len = aux.length;
if (len == 0) campo.value = '';
if (len == 1) campo.value = '0'+ separador_decimal + '0' + aux;
if (len == 2) campo.value = '0'+ separador_decimal + aux;
if (len > 2) {
aux2 = '';
for (j = 0, i = len - 3; i >= 0; i--) {
if (j == 3) {
aux2 += separador_milhar;
j = 0;
}
aux2 += aux.charAt(i);
j++;
}
campo.value = '';
len2 = aux2.length;
for (i = len2 - 1; i >= 0; i--)
campo.value += aux2.charAt(i);
campo.value += separador_decimal + aux.substr(len - 2, len);
}
return false;
}
</script>
<script type="text/javascript" src="formatar_moeda.js"></script>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="col-xs-10 col-md-10">
<form class="form-inline" name="form1" method="post" action="EnviaDados.php" onsubmit="return validaForm()" >
<table width="92%" class="table table-striped table table-bordered" >
<tr>
<td colspan="6" align="center"><p><strong>Informação de Mercado</strong></p></td>
</tr>
<tr>
<td width="46%" align="center">Promotor</td>
<td width="12%">.Cod. Produto</td>
<td width="15%" rowspan="2"><strong>aqui vai aparecer a descriação do produto que esta no BD</strong></td>
<td width="8%">Preço Nosso</td>
<td width="10%">Preco concorrente</td>
<td width="9%">Nome do atacado</td>
</tr>
<tr>
<td align="center"><span class="teste">
<select class="form-control" name="quem" id="quem">
<option value="" selected="selected">Selecione o Promotor</option>
<option value= " Jose " > Jose </option>
</select>
</span></td>
<td><input name="codloja" type="text" id="codloja" size="20" maxlength="100"></td>
<td align="center"><input name="seg" type="text" id="seg" size="5" maxlength="2"></td>
<td align="center"><input name="ter" type="text" id="ter" size="5" maxlength="2"></td>
<td align="center"><input name="qua" type="text" id="qua" size="5" maxlength="2"></td>
</tr>
<tr>
<td colspan="3"><p>Bla....Bla....Bla....Bla....Bla....Bla....Bla....Bla....Bla....Bla....Bla....Bla....Bla....Bla....Bla....Bla....Bla....Bla....</p></td>
<td colspan="3"> </td>
</tr>
<tr>
<td colspan="6"><p>Bla....Bla....Bla....Bla....Bla....</p></td>
</tr>
<tr>
<td colspan="6" align="center">
<button type="submit" class="btn btn-primary">Enviar</button>
<button type="reset" class="btn btn-primary">Limpar</button></td>
</tr>
</table>
</form>
</div>
</div>
</div>
</div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
</body>
</html>Discussão (4)
Carregando comentários...