Page 1 of 1

Previous & next navigation over results, problem.

Posted: Mon Mar 24, 2003 6:51 pm
by Igguana
I have a query limited to 10, and I'm using this href to send to the page again the variables in order to reload in the next ten results.

Code: Select all

<?php
if ( $coincidencias >= 11){
echo "<a href='"; 
echo "resultados2.html?incremento=10&envio1="; 
echo $_POST['envio1']; 
echo '&envio2='; 
echo $_POST['envio2']; 
echo '&envio3='; 
echo $_POST['envio3']; 
echo '&envio4='; 
echo $_POST['envio4'];
echo '&envio5='; 
echo $_POST['envio5']; 
echo '&envio6='; 
echo $_POST['envio6'];
echo '&herencia=';
echo $aumento;
echo "'>10 resultados siguientes>></a>"; 
} else { echo '<font face=Verdana, Arial, Helvetica, sans-serif><b><font size=1 color=#999999>10 
        resultados siguientes>></font></b>';
} 
?>
After this, this formula has to grab it and serve it as I want, but the fact is that it only does it once, in the second time, the variables are empty.

Code: Select all

<?php
$herencia = (!empty($_GET['herencia']) && is_numeric($_GET['herencia'])) ? $_GET['herencia'] : 0; 
$incremento = (!empty($_GET['incremento'])) ? $_GET['incremento'] : 0; 
$aumento = $herencia + $incremento;
if ($aumento < 0) 
   $aumento = 0; 
$query = 'SELECT * ' . $query . ' LIMIT ' . $aumento . ', 10'; 
?>
What happens??

Posted: Mon Mar 24, 2003 7:10 pm
by volka
$_POST only contains the parameters send via POST-method.
But shipping them within an url ( <a href="resultados2.html?incremento=10&envio1=.... ) is the GET-method. You have to either check both arrays ($_POST/$_GET) or use $_REQUEST
see also: http://www.php.net/manual/en/reserved.variables.php

Posted: Mon Mar 24, 2003 7:11 pm
by Igguana
Sorry, the way I catch the rest of the variables is this.
They previously come from a form.

Code: Select all

<?php
if (isset($_REQUEST['envio1'] ) && $_REQUEST['envio1'] != -1) 
   $clauses[] = "Modo='".mysql_escape_string($_REQUEST['envio1'])."'"; 

if (isset($_REQUEST['envio2'] ) && $_REQUEST['envio2'] != -1) 
   $clauses[] = "Localidad='".mysql_escape_string($_REQUEST['envio2'])."'"; 

if (isset($_REQUEST['envio3'] ) && $_REQUEST['envio3'] != -1) 
   $clauses[] = "Tipo='".mysql_escape_string($_REQUEST['envio3'])."'"; 


if (isset($_REQUEST['envio4'] ) && $_REQUEST['envio4'] != -1) 
   $clauses[] = 'Habitaciones='.(int)$_REQUEST['envio4']; 

if (isset($_REQUEST['envio5'] ) && $_REQUEST['envio5'] != -1) 
   $clauses[] = 'Precio<='.(int)$_REQUEST['envio5']; 

if (isset($_REQUEST['envio6'] ) && $_REQUEST['envio6'] != -1) 
   $clauses[] = "Zona='".mysql_escape_string($_REQUEST['envio6'])."'";
?>

Posted: Mon Mar 24, 2003 7:13 pm
by Igguana
Thank U one more time, Volka.
I was living in Germany for some time, in the very east, it was great!
:D

Posted: Mon Mar 24, 2003 7:19 pm
by volka
before or after the wall fell?

Posted: Mon Mar 24, 2003 7:23 pm
by Igguana
After, I was in Weimar during the year of the Kulturstat, In 1999.
I also been in Berlin, some days, wonderfull city I would like to come back.