Ver Mensaje Individual
  #10 (permalink)  
Antiguo 16/08/2011, 10:19
angelmadrid
 
Fecha de Ingreso: octubre-2009
Mensajes: 75
Antigüedad: 14 años, 7 meses
Puntos: 0
Respuesta: Pasar checkbox paginacion

Pues nada por mucho que lo intento me sigue saliendo igual es decir con los check sin que se queden marcados, este es el codigo que tengo , incoorporando el tuyo

Código HTML:
<script type="text/javascript">
function guardar()
{
	
    document.getElementById('hd_check').value='';
    var check = document.getElementsByTagName('input');
    for(i=0;i<check.length;i++)
    {
        if(check[i].type=='checkbox')
        {
            if(check[i].checked)
                document.getElementById('hd_check').value += check[i].id + "#";
        }
    }
}
function cargar()
{
    var hd_check = document.getElementById('hd_check').value.split('#');
    var check = document.getElementsByTagName('input');
    for(i=0;i<check.length;i++)
    {
        if(check[i].type=='checkbox')
        {
            for(j=0;j<hd_check.length;j++)
            {
                if(hd_check[j] == check[i].id)
                    document.getElementById(check[i].id).checked;
            }
        }
        
    }
}
</script>

<?php 



$base="peliculas"; 
$con=mysql_connect('localhost', 'root', ''); 
mysql_select_db($base,$con); 

if (!isset($pg)) 
$pg = $_GET['pg'];; // $pg es la pagina actual 
$cantidad=3; // cantidad de resultados por página 
$inicial = $pg * $cantidad; 


$pegar = "SELECT nombre, estreno, resumen from peliculas order by nombre asc LIMIT $inicial,$cantidad"; 
$cad = mysql_db_query($base,$pegar) or die (mysql_error()); 

$contar = "SELECT * FROM peliculas ORDER BY nombre"; 
$contarok= mysql_db_query($base,$contar); 
$total_records = mysql_num_rows($contarok); 
$pages = intval($total_records / $cantidad); 
	
	?>
	<form id="form1" action="123.php" method="post" >
<table height="522" width="846">

  <tr>
	  <td width="561">
	   
		  <?
				while($fila = mysql_fetch_array( $cad  ))
					
					{
					
				?>
				
				<tr>
					  <td width="69" >
							<img src="/imagenes/peliculas/<? echo $fila['nombre'];?>.jpg" width="69" height="93" alt="<? echo $fila['nombre'];?>" /> 
					</td>
					 <td width="242" height="24">
						<div id="enlace1" align="right"><font size="1"><a target="_blank" href="resumenes/<? echo $fila['nombre'];?>.php"><? echo $fila['nombre'];?></a></font></div>
					</td>
					 <td width="20">
					  <input type="checkbox" name="dvd[]" value="<? echo $fila['nombre'];?>" id="<? echo $fila['fecha'];?>" />
					  
					  <input type="hidden" value="" id="hd_check" />
					</td>
				</tr>
		  <?
					}
	?>
	<input type="submit" id="bt_sb" onclick="guardar()" value="otra_pagina"  onclick="guardar();cargar();" />
	</form>
	</td>

  </tr>
</table>	
	
	
<?
// Creando los enlaces de paginación 
echo "<p>"; 
if ($pg <> 0) 
{ 
$url = $pg - 1; 
echo "<a href='123.php?pg=".$url."' onClick=\"guardar();cargar();\">« Anterior</a> "; 
} 
else { 
echo " "; 
} 

for ($i = 0; $i<($pages + 1); $i++) { 
if ($i == $pg) { 
echo "<font face=Arial size=2 color=ff0000><b> $i </b></font>"; 
} 
else { 
echo "<a href='123.php?pg=".$i."' onClick=\"guardar();cargar();\">".$i."</a> "; 
} 
}  

if ($pg < $pages) { 
$url = $pg + 1; 
echo "<a href='123.php?pg=".$url."' onClick=\"guardar();cargar();\">Siguiente »</a>"; 
} 
else { 
echo " "; 
} 
echo "</p>"; 

// Cerrar la conexión con la BD
	mysql_close($con);	
?> 
</body>
</html> 
Un saludo y gracias por tu tiempo