Jump to content
Fórum Script Brasil
  • 0

Form


Eduardo DB

Question

To montando um sistema de pesquisa pelo codigo

na folha onde ta a relacao sempre sai 5 digitos então se o codigo for 25 vai sair 00025

e tem algumas pessoas digitando pelo menos 1 desses zeros queria saber se tem como colocar pra se no campo iniciar por 0 ele deleta automaticamente

tpw

digita 010 ele deleta o 0 inicial e pesquisa 10

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

não deu :mellow:

A Pagina essa

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Pesquisa Endere&ccedil;o</title>

</head>

<body onload="vForm()">
<script type="text/javascript" src="JS/wz_tooltip.js"></script>
<script language="JavaScript">
    function vForm(){
    d = document.form1;
        d.cod.focus();
}
</script>
<link rel="stylesheet" type="text/css" href="JS/shadowbox.css">
<link rel="stylesheet" type="text/css" href="JS/index.css">
<script type="text/javascript" src="JS/shadowbox.js"></script>
<script type="text/javascript" src="JS/wz_tooltip.js"></script>
<script type="text/javascript">
Shadowbox.init();
</script>

<?
 include "conexao.php";
 $cod = $_POST['cod'];
?>

<table border="0" align="center" background="img/bg.png">
  <tr>
    <td height="26"><form id="form1" name="form1" method="post" action="index.php?funcao=exibe"">
        Codigo:<input type="text" name="cod" id="cod" />
             </td><td><input type="image" name="button" id="button" src="img/busca.png" width="80" height="20"/>
    </form></td>
    <td width="8" height="26">&nbsp;</td>   
    <td width="85" height="26" valign="middle"><a href="add.php" ><img src="img/add.png" height="20" width="120"/></a></td>  
    <td width="8" height="26">&nbsp;</td>   
    <td width="85" height="26" valign="middle"><a href="" onClick="window.open('consulta.php','Janela','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=600,height=300,left=25,top=25'); return false;"><img src="img/consulta.png" height="20" width="120"/></a></td>  

  </tr>
</table>


<? 
if($_GET['funcao'] == "exibe"){
$pega_cod = $_POST['cod'];
$pega_cod2 = $_GET['cod'];
        
if(empty($pega_cod)){
$exibe_cod = $pega_cod2;
}else{
$exibe_cod = $pega_cod;
}

    ?>
   <?
$exibe_sql = mysql_query("SELECT * FROM prod WHERE cod = '$exibe_cod'");

while($exibe_c=mysql_fetch_array($exibe_sql)){
    $verifica_name = $exibe_c['prod'];
if(empty($verifica_name)){
        $nome_prod = 'Produto não cadastrado';
    }else{
$nome_prod = $exibe_c['prod'];
    }
$marca_prod = $exibe_c['Marca'];

$exibe_forn = mysql_query("SELECT * FROM forn WHERE COD = '$marca_prod'");
while($exibe_f=mysql_fetch_array($exibe_forn)){

    $marca_n = $exibe_f['NOME'];

}}
?> 
<bR><bR>
<table border="0" align="center" background="img/bg.png">
  <tr>
    <td><? echo $exibe_cod;?>&nbsp;-&nbsp;<? echo $nome_prod;?>&nbsp;-&nbsp;<? echo $marca_n;?></td>
  </tr>
</table>
<br><bR><div align="center">
  <?

$link = '<a rel="shadowbox[Mixed];width=220;height=38" href="del.php?id=';
$link2 = '&cod=';
$link3 = '">
        <img src="img/del.png" width="20" height="20"/></a>';
$div = '<div onmouseover="Tip(';
$div1 = "'";
$div2 = ')" onmouseout="UnTip()" />';
$div3 = '</div>';




$colunas="5"; 
$cont="1"; 

print"<table background='img/bg.png'>";

$s = mysql_query("SELECT * FROM end WHERE cod = '$exibe_cod' LIMIT 40");

while($x=mysql_fetch_array($s)){
$end = strtoupper($x['end']);
$id = $x['id'];
$dcod = $exibe_cod;
$data = $x['data'];


if($cont==1){
print'<tr>';
}
print'<td width="60">';
print $div;
print $div1;
print $data;
print $div1;
print $div2;
print $end;
print $div3;
print '</td><td>&nbsp;</td><td>';
print $link;
print $id;
print $link2;
print $dcod;
print $link3;
print"</td><td>&nbsp;</td>";

if($cont==$colunas){
print"</tr>";
$cont=0;
}
$cont=$cont+1;
}

if(!$cont==$colunas){
print"</tr></table>";
} else {
print"</table>";
}  }?>
</table></div>
</body>
</html>

Edited by Eduardo DB
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...