PHP - problemita

 
Vista:

problemita

Publicado por kaizer (22 intervenciones) el 23/11/2007 13:36:49
hola amigos:

no puedo generar una tabla dinamica mediante una sentencia sql, les explico tengo un combobox y un boton mostrar, al momento de pinchar una opción dento del combobox no me genera la tabla dinámica les muestro el codigo que tengo.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Mantenedor de Servicios</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.Estilo1 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-weight: bold;
}
.Estilo2 {font-family: Verdana, Arial, Helvetica, sans-serif}
.Estilo3 {
font-size: 36px;
font-weight: bold;
}
body {
background-color: #FFFFFF;
}
-->
</style>
</head>

<body>

<?php
if(isset($_POST['mostrar']))
{
?>
<table width="1039" height="56" border="1" bordercolor="#000000">
<tr> <center>
<td class="Estilo1" align=center><div align="center">BP</div></td>
<td class="Estilo1" align=center><div align="center">NOMBRE</div></td>
<td class="Estilo1" align=center><div align="center">FECHA</div></td>
<td class="Estilo1" align=center><div align="center">ESTADO</div></td>
<td class="Estilo1" align=center><div align="center">ZONA</div></td>
<td class="Estilo1" align=center><div align="center">METRICULA</div></td>
</center>
</tr>
<?php
$conn = mysql_connect("localhost", "", "");
mysql_select_db("mi_base", $conn);
$sql2 = "Select * from turnos where turno='$turno'";

$sql = mysql_query($sql2, $conn);

while($row = mysql_fetch_row($sql)){
?>
<tr>
<?php $bp = $row[0]; ?>
<td align=center><span class="Estilo2"><a href="sinturno.php?bp=<?php echo $row[0]; ?>"> <?php echo $row[0]; ?></a></span></td>
<td align=center><span class="Estilo2"><?php echo $row[1]; ?></span></td>
<td align=center><span class="Estilo2"><?php echo $row[2]; ?></span></td>
<td align=center><span class="Estilo2"><?php echo $row[3]; ?></span></td>
<td align=center><span class="Estilo2"><?php echo $row[4]; ?></span></td>
<td align=center><span class="Estilo2"><?php echo $row[5]; }?></span></td>S
</tr>
<?php

mysql_free_result($sql);
mysql_close($conn);
?>
</table>
<?php } ?>

<form action="mantservicio.php" method="post" name="form1" target="_self">
<table width="1037" border="1" bordercolor="#000000">
<tr>
<td width="1027" bordercolor="#FFFFFF" bgcolor="#FFFFFF"><div align="center" class="Estilo2 Estilo3">ESTADOS
DE PERSONAL</div></td>
</tr>
</table>
<br>
<br>
<table width="73%">
<tr>
<td width="16%">Seleccione Estado</td>
<td width="84%"><option value="<?php echo $row[0]?>"></option>

<select name="turno">
<option value="0"> </option>
<?
$conn = mysql_connect("localhost", "", "");
mysql_select_db("mi_base", $conn);

$sql = "select distinct turno from turnos where turno='CP' or turno='LF'";
$r = mysql_query($sql);

while($row = mysql_fetch_row($r)){

?>
<option value="<?php echo $row[0]?>"> <?php echo $row[0]?> </option>

<? } ?>
</select>
<input type="submit" name="mostrar" value="Mostrar"></td>
</tr>
</table>

<br>

<table width="1039" height="56" border="1" bordercolor="#000000">
<tr>
<td width="81" align=center><span class="Estilo1">BP</span></td>
<td width="207" class="Estilo1" align=center>NOMBRE</td>
<td width="330" class="Estilo1" align=center>FECHA</td>
<td width="121" class="Estilo1" align=center>ESTADO</td>
<td width="117" class="Estilo1" align=center>ZONA</td>
<td width="143" class="Estilo1" align=center>MATRICULA</td>
</tr>
<?php
$conn = mysql_connect("localhost", "", "");
mysql_select_db("mi_base", $conn);
$sql2 = "Select * from turnos where turno='CP' or turno='LF'";

$sql = mysql_query($sql2, $conn);

while($row = mysql_fetch_row($sql)){
?>
<tr>
<?php $bp = $row[0]; ?>
<td align=center><span class="Estilo2"><a href="mantservicio.php?bp=<?php echo $row[0]; ?>"> <?php echo $row[0]; ?></a></span></td>
<td align=center><span class="Estilo2"><?php echo $row[1]; ?></span></td>
<td align=center><span class="Estilo2"><?php echo $row[2]; ?></span></td>
<td align=center><span class="Estilo2"><?php echo $row[3]; ?></span></td>
<td align=center><span class="Estilo2"><?php echo $row[4]; ?></span></td>
<td align=center><span class="Estilo2"><?php echo $row[5]; }?></span></td>
</tr>
<?php

mysql_free_result($sql);
mysql_close($conn);
?>
</table>
<input type="submit" name="Agregar" value="Agregar">
<input type="submit" name="Volver" value="Volver">
</form>
</body>
</html>


saludos cordiales
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:problemita

Publicado por Diego Romero (1450 intervenciones) el 23/11/2007 16:31:03
¿Dónde está definido $turno?, ¿cuál es el código del script "mantservicio.php"?
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar