Ver Mensaje Individual
  #3 (permalink)  
Antiguo 28/06/2008, 02:04
Avatar de Panino5001
Panino5001
Me alejo de Omelas
 
Fecha de Ingreso: mayo-2004
Ubicación: -34.637167,-58.462984
Mensajes: 5.148
Antigüedad: 20 años
Puntos: 834
Respuesta: cargar un texto deacuerdo a la seleccion de un combo

No necesitás AJAX para eso, sólo javascript. Fijate en este ejemplo:
Código PHP:
<?php
include 'db.php';//o como sea que te conectes
$qry=mysql_query("select * from tutabla");
$row=array();
while(
$r=mysql_fetch_assoc($qry)){
$row[]=array($r['curso'],$r['fecha'],$r['detscripcion']);
}
?>
<!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=iso-8859-1" />
<title>test</title>
</head>

<body>
<form id="form1" name="form1" method="post" action="">
  <select name="curso" id="curso" onchange="document.getElementById('data').value=this.options[this.selectedIndex].getAttribute('fecha')+'\n'+this.options[this.selectedIndex].getAttribute('descripcion')">
<?php foreach($row as $v){ ?>
    <option descripcion="<?php echo $v[2?>" fecha="<?php echo $v[1?>" value="<?php echo $v[0?>"><?php echo $v[0?></option>
<?php }?>
  </select>
  <textarea name="data" id="data"><?php echo $row[0][1]."\n".$row[0][2?></textarea>
</form>
</body>
</html>