Hi All!
I have the following php code in a form:
...
<input type="hidden" name="Page" value="
">
<input type="submit" name="Submit" value="Previous">
<input type="hidden" name="Page" value="
">
<input type="submit" name="Submit" value="Next">
The "next" button works fine, but the "previous" button acts weird. When pressed the first time, eg on page4, it will go to page 3. When pressed again on page3, it goes back to page 4....? I've added
and
- $p outputs the correct page number : 2, but when submitted, $Page outputs "4" instead of "2"
Does any one know why this is?
Thnx!
I have the following php code in a form:
PHP:
$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;
...
PHP:
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:
}
The "next" button works fine, but the "previous" button acts weird. When pressed the first time, eg on page4, it will go to page 3. When pressed again on page3, it goes back to page 4....? I've added
PHP:
print $p;
PHP:
print $Page
Does any one know why this is?
Thnx!