Ver Mensaje Individual
  #1 (permalink)  
Antiguo 24/02/2009, 21:24
luisoxd
 
Fecha de Ingreso: febrero-2009
Mensajes: 5
Antigüedad: 15 años, 2 meses
Puntos: 0
Pregunta Evitar Que Me Reinicie Un Valor - Paginacion PHP

Hola tengo un problema a la hora de ingresar mi formario un click en mi boton "submit: Siguiente" el valor siempre se me reinicia a la hora de hacer paginacion y siempre me muestra 0 y no avanza (al menos que le pongas atras y otra vez el mismo boton siguiente) pero asi no deberia ser alguien que me ayude quisiera que al darle click a ese boton el valor no se reinicie a 0 sino que imprima por ejemplo un 5 y asi sucesivamente de 5 en 5 ...

Luis

PD: Les dejo el codigo para que lo vean:

<html>
<head>
<script languaje="javascript">
function fSgte() {
//alert("hola");
A=parseInt(document.MyForm.oculto.value,10);
A=5+A;
document.MyForm.oculto.value = A;
}
</script>
</head>
<body>

<form method = "POST" action = "google.php" name="MyForm">
<strong>Palabra clave:</strong>
<select name="opcion">
<option>Autor</option>
<option>Nombre</option>
</select>

<input type="text" name="dato" size="20"><br><br>
<input type="text" name="oculto" value="0" size="20"><br>
<input type="submit" value="Buscar">
<input type="submit" value="Siguiente" onclick="fSgte()";name="Siguiente">
</form>

</body>
</html>

<?php

if ($GLOBALS["_POST"]) {
$opcion = $GLOBALS["_POST"]["opcion"];
$dato = $GLOBALS["_POST"]["dato"];
$oculto = $GLOBALS["_POST"]["oculto"];
//echo 'Come On!';
//echo '$buscar='.$buscar;

$link = mysql_connect("localhost", "root","mysql");

mysql_select_db("rock", $link);

$cant=5;

$sqlnombre = "SELECT Id,Nombre,Autor FROM canciones WHERE Nombre LIKE '".$dato."%' ORDER BY Id Limit ".$oculto.",".$cant." ";
$sqlautor = "SELECT Id,Nombre,Autor FROM canciones WHERE Autor LIKE '".$dato."%' ORDER BY Id Limit ".$oculto.",".$cant." ";

if ($opcion=="Autor")
$sql=$sqlautor;
else
$sql=$sqlnombre
;
$result = mysql_query($sql, $link);

if ($row = mysql_fetch_array($result)){
echo "<table border = '1'> \n";
//Mostramos los nombres de las tablas
echo "<tr> \n";
mysql_field_seek($result,0);
while ($field = mysql_fetch_field($result)){
echo "<td><b>$field->name</b></td> \n";
}
echo "</tr> \n";

do {
echo "<tr> \n";
//echo "<td><a href=edicion.php?Id=.$row[Id]&Autor=.$row[Autor]&Nombre=.$row[Nombre].>".$row["Id"]."</a></td> \n";
echo "<td><a href=edicion.php?Id=".$row["Id"].">".$row["Id"]."</a></td> \n";
echo "<td>".$row["Nombre"]."</td> \n";
echo "<td>".$row["Autor"]."</td> \n";
echo "</tr> \n";
} while ($row = mysql_fetch_array($result));

echo "<p><a href=google.php>Volver</p> \n";
echo "</table> \n";
} else {
echo "<p>No se ha encontrado ningn registro!</p>\n";
echo "<p><a href=google.php>Volver</p> \n";
}
}
?>