Ver Mensaje Individual
  #1 (permalink)  
Antiguo 05/11/2010, 07:19
Eslava86
 
Fecha de Ingreso: noviembre-2010
Mensajes: 4
Antigüedad: 13 años, 6 meses
Puntos: 0
Checkbox que se borran

Buenas, hice una pregunta un par de días a la comunidad para una duda sobre una pagina de futbol, en la que estoy trabajando. Pero he seguido trabajando, y en la parte donde cada jugador entra y hace click en cada checkbox para decir si viene o no, luego al refrescar la página o entra otra persona se borra, por lo que es muy difícil saber quien viene y quien no.

Os pongo el codigo de la página:

Código:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html>

<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
		<title>Olivereta United.tk</title>
		<link href="style.css" rel="stylesheet" type="text/css" media="all"/>
	</head>



<body>
	<div id="container">

		<div id="main-title"><span style="font-weight: 400"><font face="Arial Black" style="font-size: 9"><span style="font-weight: 400">Olivereta United</span></font></span></div>
		<div id="header-image"></div>
		<div id="navbar">

			<font face="Arial Black" style="font-size: 9">

			<a href="Equipo.html"><span style="font-weight: 400">Equipo</span></a><span style="font-weight: 400"> ||
			</span>
		<a href="Contacto.html"><span style="font-weight: 400">Contacto</span></a><span style="font-weight: 400"> ||
			</span>
		<a href="Proximo partido.html"><span style="font-weight: 400">Próximo partido</span></a></font></div>
    <div id="body">
     <?php
     if (isset($_POST['expediente']))
     {
         foreach ($_POST['expediente'] as $expediente_s)
             $seleccionado[$expediente_s] = "checked='checked'";
     }
 		?>
			<h1><font face="Arial">Viernes, 05/11/2010</font></h1>
			<form id="form1" action="mantener_checkbox.php" method="post">
			<div id="main-text">
            <title></title>
            <title></title>
            <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
			<link href="Proximo partido.html" rel="stylesheet" type="text/css">

              <p class="byline">&nbsp;</p>
              <p>&nbsp;</p>
            <table width="400" border="0" align="center">
              <tr>
                <td width="200" rowspan="2" align="center" bgcolor="#999999">Jugadores</td>
                <td colspan="2" align="center" bgcolor="#999999">Asistencia</td>
              </tr>
              <tr>
                <td width="100" align="center" bgcolor="#999999">Si</td>
                <td width="100" align="center" bgcolor="#999999">No</td>
              </tr>
              <tr>
                <td width="200" align="center">Marcos</td>
                <td align="center"><input type="checkbox" onclick="if(this.checked) this.form.submit();" name="expediente[]" <?php echo $seleccionado['1'] ?> value="1" /></td>
                <td align="center"><input type="checkbox" name="expediente[]" <?php echo $seleccionado['2'] ?> value="2" />
                  <br /></td>
              </tr>
              <tr>
                <td width="200" align="center" bgcolor="#CCCCCC">Jose Miguel</td>
                <td align="center" bgcolor="#CCCCCC"><input type="checkbox" name="expediente[]" <?php echo $seleccionado['3'] ?> value="3" />
                  <br /></td>
                <td align="center" bgcolor="#CCCCCC"><input type="checkbox" name="expediente[]" <?php echo $seleccionado['4'] ?> value="4" />
                  <br /></td>
              </tr>
              <tr>
                <td width="200" align="center">Joaquin</td>
                <td align="center"><input type="checkbox" name="expediente[]" <?php echo $seleccionado['5'] ?> value="5" />
                  <br /></td>
                <td align="center"><input type="checkbox" name="checkbox6" id="checkbox6" /></td>
              </tr>
              <tr bgcolor="#CCCCCC">
                <td width="200" align="center">Alejandro</td>
                <td align="center"><input type="checkbox" name="checkbox4" id="checkbox4" /></td>
                <td align="center"><input type="checkbox" name="checkbox3" id="checkbox3" /></td>
              </tr>
              <tr>
                <td width="200" align="center">Alberto</td>
                <td align="center"><input type="checkbox" name="checkbox" id="checkbox" /></td>
                <td align="center"><input type="checkbox" name="checkbox2" id="checkbox2" /></td>
              </tr>
              <tr bgcolor="#CCCCCC">
                <td width="200" align="center">Guillermo</td>
                <td align="center"><input type="checkbox" name="checkbox4" id="checkbox4" /></td>
                <td align="center"><input type="checkbox" name="checkbox3" id="checkbox3" /></td>
              </tr>
              <tr>
                <td width="200" align="center">Nacho</td>
                <td align="center"><input type="checkbox" name="checkbox" id="checkbox" /></td>
                <td align="center"><input type="checkbox" name="checkbox2" id="checkbox2" /></td>
              </tr>
              <tr bgcolor="#CCCCCC">
                <td width="200" align="center">Carlos</td>
                <td align="center"><input type="checkbox" name="checkbox4" id="checkbox4" /></td>
                <td align="center"><input type="checkbox" name="checkbox3" id="checkbox3" /></td>
              </tr>
              <tr>
                <td width="200" align="center">Jose Vicente</td>
                <td align="center"><input type="checkbox" name="checkbox" id="checkbox" /></td>
                <td align="center"><input type="checkbox" name="checkbox2" id="checkbox2" /></td>
              </tr>
              <tr bgcolor="#CCCCCC">
                <td align="center">Juanjo</td>
                <td align="center"><input type="checkbox" name="checkbox4" id="checkbox4" /></td>
                <td align="center"><input type="checkbox" name="checkbox3" id="checkbox3" /></td>
              </tr>
              <tr>
                <td width="200" align="center">Juan</td>
                <td align="center"><input type="checkbox" name="checkbox4" id="checkbox4" /></td>
                <td align="center"><input type="checkbox" name="checkbox3" id="checkbox3" /></td>
              </tr>
            </table>
            <p class="byline">&nbsp;</p>
            <input type="submit" name="Procesar" value="Confirmar" />
            <p class="left">&nbsp;</p>
<p class="byline">&nbsp;</p>
<div id="footer">
  <div> <font face="Arial Black" class="current">Designed by <a href="http://www.f8d.net">f8d</a>, modificated by Marcos Eslava</font></div>
			  </div>
			</div>
		</div>

	</div>
	</body>
</html>
A continuación os pongo el archivo que tengo de php, pero lo que no tengo muy claro si pongo todo lo que tengo que poner.

Código:
<?php

     if (isset($_POST['expediente']))
     {
         foreach ($_POST['expediente'] as $expediente_s)
             if ($expediente_s == 1){
if (!isset($_POST['Procesar'])){
echo "<h2>Se hizo submit con Checkbox nº 1</h2>";
}

}else{
echo "también se marcó el CheckBox nº $expediente_s <br />";

}
     }
if (isset($_POST['Procesar'])){
echo "<h2>Se hizo submit con Boton</h2>";
}
Bueno espero haberme explicado correctamente, soy nuevo en esto y voy un poco perdido. Gracias por adelantado.