Este es el código con la paginación, las variables que obtengo del formulario las paso con POST y el problema radica es que se pierden (las variables del post) cuando paso al siguiente juego de registros del paginador...
gracias:
Código PHP:
<?php require_once('../../Connections/conexion1.php'); ?>
<?php
$colname_Recordset1= $HTTP_POST_VARS['T1'];
$currentPage = $HTTP_SERVER_VARS["PHP_SELF"];
$maxRows_Recordset1 = 10;
$pageNum_Recordset1 = 0;
if (isset($HTTP_GET_VARS['pageNum_Recordset1'])) {
$pageNum_Recordset1 = $HTTP_GET_VARS['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
if (isset($HTTP_POST_VARS['T1'])) {
$colname_Recordset1 = (get_magic_quotes_gpc()) ? $HTTP_POST_VARS['T1'] : addslashes($HTTP_POST_VARS['T1']);
}
mysql_select_db($database_conexion1, $conexion1);
$query_Recordset1 = sprintf("SELECT * FROM TABLA WHERE CAMPO2 = '%s'", $colname_Recordset1);
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $conexion1) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
if (isset($HTTP_GET_VARS['totalRows_Recordset1'])) {
$totalRows_Recordset1 = $HTTP_GET_VARS['totalRows_Recordset1'];
} else {
$all_Recordset1 = mysql_query($query_Recordset1);
$totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;
$queryString_Recordset1 = "";
if (!empty($HTTP_SERVER_VARS['QUERY_STRING'])) {
$params = explode("&", $HTTP_SERVER_VARS['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_Recordset1") == false &&
stristr($param, "totalRows_Recordset1") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_Recordset1 = "&" . implode("&", $newParams);
}
}
$queryString_Recordset1 = sprintf("&totalRows_Recordset1=%d%s", $totalRows_Recordset1, $queryString_Recordset1);
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<div align="center">
<p>PRUEBA 5</p>
<p> </p>
<p> </p>
<table border="1" cellpadding="1" cellspacing="1">
<tr>
<td>CAMPO1</td>
<td>CAMPO2</td>
<td>CAMPO3</td>
<td>CAMPO4</td>
<td>CAMPO5</td>
<td>CAMPO6</td>
<td>CAMPO7</td>
<td>CAMPO8</td>
<td>CAMPO9</td>
<td>CAMPO10</td>
<td>CAMPO11</td>
</tr>
<?php do { ?>
<tr>
<td><?php echo $row_Recordset1['CAMPO1']; ?></td>
<td><?php echo $row_Recordset1['CAMPO2']; ?></td>
<td><?php echo $row_Recordset1['CAMPO3']; ?></td>
<td><?php echo $row_Recordset1['CAMPO4']; ?></td>
<td><?php echo $row_Recordset1['CAMPO5']; ?></td>
<td><?php echo $row_Recordset1['CAMPO6']; ?></td>
<td><?php echo $row_Recordset1['CAMPO7']; ?></td>
<td><?php echo $row_Recordset1['CAMPO8']; ?></td>
<td><?php echo $row_Recordset1['CAMPO9']; ?></td>
<td><?php echo $row_Recordset1['CAMPO10']; ?></td>
<td><?php echo $row_Recordset1['CAMPO11']; ?></td>
</tr>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</table>
<p>
<table border="0" width="50%" align="center">
<tr>
<td width="23%" align="center"> <?php if ($pageNum_Recordset1 > 0) { // Show if not first page ?>
<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, 0, $queryString_Recordset1); ?>">First</a>
<?php } // Show if not first page ?> </td>
<td width="31%" align="center"> <?php if ($pageNum_Recordset1 > 0) { // Show if not first page ?>
<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, max(0, $pageNum_Recordset1 - 1), $queryString_Recordset1); ?>">Previous</a>
<?php } // Show if not first page ?> </td>
<td width="23%" align="center"> <?php if ($pageNum_Recordset1 < $totalPages_Recordset1) { // Show if not last page ?>
<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, min($totalPages_Recordset1, $pageNum_Recordset1 + 1), $queryString_Recordset1); ?>">Next</a>
<?php } // Show if not last page ?> </td>
<td width="23%" align="center"> <?php if ($pageNum_Recordset1 < $totalPages_Recordset1) { // Show if not last page ?>
<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, $totalPages_Recordset1, $queryString_Recordset1); ?>">Last</a>
<?php } // Show if not last page ?> </td>
</tr>
</table></p>
</div>
</body>
</html>
<?php
mysql_free_result($Recordset1);