Ver Mensaje Individual
  #1 (permalink)  
Antiguo 22/04/2011, 09:48
seiyatesinx
 
Fecha de Ingreso: mayo-2009
Mensajes: 20
Antigüedad: 15 años
Puntos: 0
Error tonto en PHP + SQL

Tengo echo un formulario con un desplegable de los socios de mi libreria, el objetivo es hacer un select dependiendo del socio elegido del menu desplegable, llevo rato buscando el error i no doy con la solucion

Aqui el codigo

Formulario

<html>
<head>
<title>Informes</title>
</head>
<body>

<?php
//Conectar
include("conect.php");
$link=Conectarse();
$consulta4="select nom,nom from socis";
$desp2=mysql_query($consulta4,$link);

?>
<FORM METHOD=POST ACTION="inform2.php">
<table>
<tr>
<td><b>Selecciona Titol</td></b>
<td><select name="informe">
<option value=''>Seleccionar</option>
<?
while ($row=mysql_fetch_array($desp2)){
echo "<option value='".$row['0']."'>".$row['1']."</option>";
}
?>
</select></td></b>



</tr>
</table>
<INPUT TYPE="submit" NAME="accion" VALUE="Enviar">
</FORM>
</body>
</html>



La pagina donde la informacion es enviada:


<html>
<head><title>Informes</title></head>
<body>
<?php
include("conect.php");
$link=Conectarse();
$informe = $_POST['informe'];
echo "$informe";
$informador = "SELECT titol,prestec,tornada FROM prestecs where soci=$_POST['informe']";
$informet = mysql_query($informador,$link);
?>



<TABLE BORDER=1 CELLSPACING=1 CELLPADDING=1>
<tr><td>Titol</td></b>
<td>Prestec</td></b>
<td>Tornada</td></b>


</tr>
<?php
while($row = mysql_fetch_array($informador)) {
?>
<tr>

<td><?php echo $row["titol"] ?></td>
<td><?php echo $row["prestec"] ?></td>
<td><?php echo $row["tornada"] ?></td>


<?php
} // cerramos el while
?>
</table>
</body>
</html>


// Gracias