PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
Igguana
Forum Commoner
Posts: 36 Joined: Tue Mar 11, 2003 1:08 pm
Post
by Igguana » Mon Mar 24, 2003 6:51 pm
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??
volka
DevNet Evangelist
Posts: 8391 Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger
Post
by volka » Mon Mar 24, 2003 7:10 pm
$_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
Igguana
Forum Commoner
Posts: 36 Joined: Tue Mar 11, 2003 1:08 pm
Post
by Igguana » Mon Mar 24, 2003 7:11 pm
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'])."'";
?>
Igguana
Forum Commoner
Posts: 36 Joined: Tue Mar 11, 2003 1:08 pm
Post
by Igguana » Mon Mar 24, 2003 7:13 pm
Thank U one more time, Volka.
I was living in Germany for some time, in the very east, it was great!
volka
DevNet Evangelist
Posts: 8391 Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger
Post
by volka » Mon Mar 24, 2003 7:19 pm
before or after the wall fell?
Igguana
Forum Commoner
Posts: 36 Joined: Tue Mar 11, 2003 1:08 pm
Post
by Igguana » Mon Mar 24, 2003 7:23 pm
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.