Ver Mensaje Individual
  #8 (permalink)  
Antiguo 29/08/2007, 07:55
Avatar de Carxl
Carxl
Colaborador
 
Fecha de Ingreso: agosto-2006
Ubicación: Bogotá
Mensajes: 2.993
Antigüedad: 17 años, 9 meses
Puntos: 70
Exclamación Re: Se puede hacer con AJAX??

Hola de nuevo GatorV...

Mira lo que he hecho hasta ahora y no me funciona...

La página donde esta el select y los input, formulario.php:
Código PHP:
<script src="funciones_js/prototype.js" type="text/javascript"></script>
<script language="javascript">
Event.observe( 'window', 'load', function() 
{
      $('cliente').onchange = function() 
      {
              var itemSelected = this.options[this.selectedIndex].value;
              var pars = "idcliente=" + escape(itemSelected);
              new Ajax.Request( 'select.php',
              {        
                      method: 'get',parameters: pars,onSuccess: function(transport) 
                      {
                        fillDatos( transport.responseText );
                    }
              }
      };
});

function fillDatos( response ) {
      var items = response.split( "||" );
      var direccion = items[0];
      var telefono = items[1];
      var email = items[2];

      $('direccion' ).value = direccion;
      $('telefono').value = telefono;
      $('web').value = email;
}
</script>
.
.
.
.
<body>
<select name="cliente" id="cliente">
                    <option>Seleccione</option>
                <?php
                
do
                {
                
?>
                    <option value="<?php echo $row[0]?>"><?php echo substr($row[1],0,15)?></option>
                <?php
                
}while($row=mysql_fetch_array($result));                
                
?>
                </select>
                <input id="telefono" name="telefono"/>
                <input id="direccion" name="direccion"/>
                <input id="web" name="web"/>
</body>
La del script, select.php:
Código PHP:
require("funciones_php/funciones.php");

$idc=$_GET['idcliente'];

$link=conexiondb();
if(
$link!=1)
{
    
$consulta="select * from ccl_clientes where ccl_cliente_id='$idc'";
    
$re=mysql_query($consulta);
    
$ro=mysql_fetch_array($re);
    echo 
$ro[4].$ro[6].$ro[8];    

Asì como no està.... ni siquiera intenta hacer nada jejejeje , pareciera que ni recibe el GET.

Gracias de antemano...

Saludos!!
__________________
Hay 10 tipos de personas, los que entienden binario y los que no. (Anónimo)
www.programandoweb.com

Última edición por Carxl; 29/08/2007 a las 08:10