Ver Mensaje Individual
  #9 (permalink)  
Antiguo 15/05/2003, 22:32
cesar24
 
Fecha de Ingreso: marzo-2003
Ubicación: Bogotá
Mensajes: 199
Antigüedad: 21 años, 1 mes
Puntos: 0
validar radio button

Nop, a ver ya hice bien el ejercicio paso a paso, pasa lo siguiente

Notice: Undefined offset: 0 in E:\sitios web\pruebas\ver.php on line 8
Fecha: Martes --> Código: Fecha: Martes --> Código: 6Fecha: Martes --> Código: 8Fecha: Martes --> Código: 11Fecha: Martes --> Código: 12Fecha: Martes --> Código: 15Fecha: Martes --> Código: 16Fecha: Martes --> Código: 17
Notice: Undefined offset: 8 in E:\sitios web\pruebas\ver.php on line 8
Fecha: Jueves --> Código:
Notice: Undefined offset: 9 in E:\sitios web\pruebas\ver.php on line 8
Fecha: Jueves --> Código:
Notice: Undefined offset: 10 in E:\sitios web\pruebas\ver.php on line 8
Fecha: Jueves --> Código: Fecha: Jueves --> Código: 22Fecha: Jueves --> Código: 23
Notice: Undefined offset: 13 in E:\sitios web\pruebas\ver.php on line 8
Fecha: Jueves --> Código:
Notice: Undefined offset: 14 in E:\sitios web\pruebas\ver.php on line 8
Fecha: Jueves --> Código:
Notice: Undefined offset: 15 in E:\sitios web\pruebas\ver.php on line 8
Fecha: Jueves --> Código:
Notice: Undefined offset: 16 in E:\sitios web\pruebas\ver.php on line 8

Notice: Undefined offset: 16 in E:\sitios web\pruebas\ver.php on line 8
Fecha: --> Código:

Fuera del error se ve que salen todas los valores del radio bottion, tanto seleccionados, como no, así seleccione solo uno sale todo eso, vuelvo a mandar el código a ver que paso

*-------***************************************

function conectar($curso) {

$sql = "SELECT cod_contexto,nombre,dia,profesor,cupo FROM contexto WHERE $curso='SI' ";

$IdConexion = mysql_connect("localhost","","") or die ('I cannot connect to the database.');

mysql_select_db("colegio",$IdConexion);
$IdConsulta = mysql_query($sql, $IdConexion);
?>

<body>

<form name="form1" method="post" action="ver.php">
<table width="100%" border="3" cellspacing="0" cellpadding="0">
<tr>
<td height="30" width="50%"><div align="center"><strong>CONTEXTO</strong></div></td>
<td width="9%"><div align="center"><strong>DIA</strong></div></td>
<td width="26%"><div align="center"><strong>PROFESOR</strong></div></td>
<td width="6%"><div align="center"><strong>CUPO</strong></div></td>
<td width="9%"><div align="center"><strong>MARCAR</strong></div></td>
</tr>
<?PHP
$total_filas = (mysql_num_rows($IdConsulta));
$contador=0;
for($i=0;$i < $total_filas;$i++)
{
$row = mysql_fetch_array($IdConsulta);
echo("<tr> <td>".$row["nombre"]."</td>");
echo("<td> <div align='center'>" . $row["dia"] . "</div></td>");
echo("<td>" .$row["profesor"] . "</td>");
echo("<td> <div align='center'>" . $row["cupo"] . "</div></td>");
echo("<td> <div align='center'> <input type='radio' name=\"codigo[$contador]\" value='" . $row["cod_contexto"] . "'></div> </td> </tr>\n\n");
echo("<input type = 'hidden' name = 'fecha[$contador]' value = '" . $row["dia"] . "'>");

$contador ++;
}
?>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="50"><div align="center">
<input type="submit" name="Submit" value="Inscribir" onClick="">
</div></td>
</tr>
</table>

</form>

<?PHP
} //Cierra la función conectar()
?>

******************************************

el código de ver.php

<?php

for ($contador=0; $contador <= count($_POST['fecha']); $contador++) {
echo "Fecha: ".$_POST['fecha'][$contador]." --> Código: ".$_POST['codigo'][$contador];
}


?>

Y ahora si ni idea, no tengo ni idea que hacer??????????, además puedo seleccionar todos los radio botton y no es la idea, se debe solo poder seleccionar uno de cada dia, por ejemplo si hay 5 de martes y 5 de jueves, solo podre seleccionar uno de martes y uno de jueves, con lo anterior podia seleccionar todos y no es la idea, ayuda por favorrrrrrrrrrrrrrrrrrrrr ????????