Ver Mensaje Individual
  #3 (permalink)  
Antiguo 10/02/2011, 19:50
johhan16
 
Fecha de Ingreso: junio-2010
Ubicación: Venezuela, Zulia
Mensajes: 686
Antigüedad: 13 años, 10 meses
Puntos: 55
Respuesta: como colocarle el mismo autocompletar a varios input

bueno en vista que nadie contesto segui indagando hasta que logre hacerlo funcionar

utilice
http://www.brandspankingnew.net/spec...ocomplete.html

y solo tuve que modificar el index.php y agregarle unas lineas

Código PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Autosuggest con AJAX v2.0</title>

<script src="bsn.AutoSuggest_2.1.3.js" type="text/javascript"></script>
<link  type="text/css" rel="stylesheet" href="autosuggest_inquisitor.css">
<script type="text/javascript">
function autosuggest(){
var options = {
    script: "get_materiales.php?limit=6&",
    varname: "materiales",
    json:false,
    maxresults:10,
       timeout:9999,
    noresults:'Ingresar nuevo material a la base de datos' 
    };
    <?php $e=1
    while(
$e <= 12) {
    
?>
var as = new bsn.AutoSuggest('materiales_input<?php echo $e?>',  options);

    <?php $e++; } ?>                       
                           
                           }
</script>
</head>
<body onload="autosuggest();">

<?
include_once('../cone.php'); 
$conn=conectarse();
if(
$_POST['materiales']!=''){
    
$material=$_POST['materiales'];
    
$existe=mysql_query("SELECT * FROM suggest WHERE title ='$material'",$conn);
                    if (
mysql_num_rows($existe) == 0mysql_query("INSERT INTO suggest (title) VALUES ('$material')",$conn);              
}
?>
<form action="<? echo $_SERVER['PHP_SELF'];?>"  method="post" id="formulario" name="form" >


<table width="80%" border="0" align="center">
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  
  <?php 
  $i
=1;
  while(
$i <= 12) {
  
  
?>
  <tr>
    <td><?php echo $i?></td>
    <td><input type="text" style="width: 200px; " id="materiales_input<?php echo $i?>" name="materiales" autocomplete="off"></td>
  </tr>
  <?php $i++; } ?>
    <tr>
    <td><input type="submit" value="Submit" /></td>
  </tr>
</table>
</form>

</body>
</html>
con esto me funciono sin problemas lo poco que he probado