hola como estas
te pongo todo el codigo
Código PHP:
Ver original<script type="text/javascript">
$(function(){
$('#descripcion').autocomplete({
selectFirst: true,
source : 'bus_art.php',
select : function(event, ui){
$('#resultados').html(
'<form name="articulo" id="articulo" method="post" action="editar_articulo.php" >'+
'<table width="100%" border="0" ><tr><td>'+
'Código:</td><td><input type="text" readonly="true" name="articulo_id" value="' + ui.item.articulo_id + '"></td>'+
'<td>EAN:</td><td><input type="text" name="ean" value="' + ui.item.ean +'"></td></tr>'+
'<tr><td>Rubro:</td><td><select name="rubro[]" id="rubro" onChange="from(document.articulo.rubro.value ,\'subrubro\',\'subrubro.php\')"><option value="' + ui.item.rubro + '"selected="selected">'+ ui.item.rubro_id+'=>'+ui.item.rubro_detalle +'</option>'+
'
<?php $sql="select * from rubros order by rubro_id asc "; $res=mysql_query($sql,Conectar
::con());?>'+
'
<?php while ($reg=mysql_fetch_array($res)){ ?><option value="
<?php echo $reg["0"]?>">
<?php echo $reg["1"];echo ("=>"); ?><?php echo $reg["2"]; ?></option>
<?php } ?></select> </td>'+
'
<?php $sql="select * from subrubros order by subrubro_id asc ";$res=mysql_query($sql,Conectar
::con());?>'+
'<td>Subrubro:</td><td id="subrubro" ><select name="subrubro[]" id="subrubro" ><option value="' + ui.item.subrub_id + '" selected="selected">' + ui.item.subrubro_detalle + '</option>'+
'
<?php while ($reg=mysql_fetch_array($res)){ ?><option value="
<?php echo $reg["0"]; ?>">
<?php echo $reg["1"]; echo ("=>")?><?php echo $reg["2"];?></option>
<?php } ?></select></td></tr>'+
'<tr><td>Descripción:</td><td><input type="text" name="descripcion" id="descripcion" value="' + ui.item.value + '">' + '</td>' +
'<td>Detalle:</td><td><input type="text" name="detalle" value="' + ui.item.detalle +'"></td></tr>'+
'
<?php $sql="select * from monedas order by mone_id asc ";$res=mysql_query($sql,Conectar
::con());?>'+
'<tr><td>Moneda:</td><td><select name="moneda[]"><option value="' + ui.item.mone_id + '" selected="selected">'+ ui.item.moneda_id +'=>'+ui.item.moneda_detalle +'</option>'+
'
<?php while ($reg=mysql_fetch_array($res)){ ?><option value="
<?php echo $reg["0"]?>">
<?php echo $reg["1"]; echo ("=>")?><?php echo $reg["2"]?></option>
<?php } ?></select></td>'+
'
<?php $sql="select * from impuestos order by iva_id asc ";$res=mysql_query($sql,Conectar
::con());?>'+
'<td>I.V.A.:</td><td><select name="iva[]"><option value="' + ui.item.iva_id + '" selected="selected">' + ui.item.iva_detalle + '</option>'+
'
<?php while ($reg=mysql_fetch_array($res)){ ?><option value="
<?php echo $reg["0"]?>">
<?php echo $reg["2"]; ?></option>
<?php } ?></select></td></tr>'+
'
<?php $sql="select * from proveedores order by proveedor_id asc ";$res=mysql_query($sql,Conectar
::con());?>'+
'<tr><td>Proveedor:</td><td><select name="proveedor[]" ><option value="' + ui.item.proveedor_id + '" selected="selected">'+ ui.item.proveedor_id+'=>'+ui.item.razon_social +'</option>'+
'
<?php while ($reg=mysql_fetch_array($res)){ ?><option value="
<?php echo $reg["0"]; ?>">
<?php echo $reg["0"]; echo ("=>")?><?php echo $reg["3"]?></option>
<?php } ?></select></td>'+
'<input type="hidden" name="arti_id" value="<?php echo "' + ui.item.arti_id + '" ;?>">'+
'<td colspan="2" align="center"> <input type="button" id="enviar" value="Editar Articulo" onfocus="javascript:return valida_articulo(articulo) ; "/></td></tr></table></form>'+
'<div style=\"text-align:center\"><img src=\"'+ ui.item.articulo_imagen +'"></div>'+
'<?php $imagen="'+ ui.item.articulo_imagen + '"; if ($imagen == ""){echo "que muestre otra imagen";} ?>'
); } }); });
</script>
</head>
<body onLoad="document.u.buscar_articulo.focus()">
<div style="height:25px">
<div style="font-size:16px; float:left; font-weight:lighter">Buscar por código|descripción</div>
<div style="float:right"><form name="u"><input type="text" id="descripcion" name="buscar_articulo" /> </form></div></div>
<div id="resultados"></div>
</body>