Queria imprimir los datos de un usuario, este usuario vendria determinado desde un formulario por metodo post:
Código:
<table border="frame" width="70%">
<tr>
<td>Usuario</td>
<td>Ciudad</td>
<td>Aficiones</td>
<td>Concertar cita</td>
</tr>
<?php
require("conexion.php");
$sent="SELECT usuario, ciudad, aficiones FROM usuarios";
$res=mysql_query($sent);
$fila=mysql_fetch_array($res);
while($fila) {
?>
<tr>
<td><?php echo $fila[0] ?></td>
<td><?php echo $fila[1] ?></td>
<td><?php echo $fila[2] ?></td>
<td>
<form action="cita.php" method="post">
<input name="cita" type="hidden" value="<?php $fila[0] ?>">
<input type="submit">
</form>
</td>
</tr>
<?php
$fila=mysql_fetch_array($res);
}
?>
</table>
En ese formulario le digo mediante un campo hidden que el valor que tome con $fila[0] que seria el nombre de usuario, me lo envie a la pagina citas.php donde tengo lo siguiente.
Código:
<?php
$cita=$_POST["cita"];
require ("conexion.php");
$sent = sprintf("SELECT * FROM usuarios WHERE usuario = '$cita'");
$res = mysql_query($sent);
$fila = mysql_fetch_row($res);
while($fila){
?>
<div id="tabla" class="fondoregistro">
<label><?php echo $fila[0] ?>:</label>
<?php echo $fila[1] ?>
<br>
<label><?php echo $fila[2] ?></label>
</div>
<?php
$fila = mysql_fetch_row($res);
}
?>
El problema es que no consigo que me impima nada de nada y no se a que puede deberse.