I have the following php code in a form:
Code: Select all
$Limit = 1;
$Page = $_REQUEST["Page"];
if(empty($Page)) {$Page = 1; }
$Start = $Page / $Limit - 1;
if($Start <= 1) {$Start = 0;}
$list = mysql_query("SELECT * FROM detail LIMIT $Start, $Limit") or die(mysql_error());
$num = mysql_num_rows($list);
$rows = $num / $Limit;
$next = $Page * $Limit;Code: Select all
if($Page > 1) {
$p = $Page - 1;
?>
<input type="hidden" name="Page" value="<?php echo $p; ?>">
<input type="submit" name="Submit" value="Previous">
<?php
if($next < $rows) {
$f = $Page + 1;
?>
<input type="hidden" name="Page" value="<?php echo $f; ?>">
<input type="submit" name="Submit" value="Next"><?php }<?php print $p; ?> and <?php print $Page ?> - $p outputs the correct page number : 2, but when submitted, $Page outputs "4" instead of "2"
Does any one know why this is?
Thnx!
d11wtq | Sorted out the
Code: Select all
tags... NOTE: You only need one set of [php ][/ php] tags around your code.... <?php ?> inside you code is automatically highlighted ;)[/color]