Code: Select all
$h = $_POST['h'];
$plusmine = $_POST['plusmine'];
If ($plusmine == "-1") //if the button back is pressed
{
If ($h < 0)
{
echo ""; //do nothing (is there any other way to say do nothing ?)
}
Else
{
$a = $h - 1; //decrease page counter by 1
echo "aa";
}
}
If ($plusmine == "+1")
{
$b = $h + 1; //increase page counter by 1
echo "bb";
}
If ($h < 1) //if i'm running it first time dont get a back button
{
echo "";
echo "";
}
Else //otherwise show it
{
echo "<form action='insert.php' method='POST'>";
echo "<input type='hidden' name='plusmine' Value='-1'>";
echo "<input type='hidden' name='h' value = '$a'>";
echo "<input type='submit' value='Back' name='back'> ";
echo "                      ";
} // the   is to make a pretty big space between back and next button... so theyre not easily confused)
If ($h != $numrows) //$numrows comes from a mysql_num_rows() call.
{
echo "<form action='insert.php' method='POST'>";
echo "<input type='hidden' name='plusmine' Value='+1'>";
echo "<input type='hidden' name='h' value = '$b'>";
echo "<input type='submit' value='Next' name='next'> ";
}
//so if the page im on is the total number of pages dont show the next button (nowhere to go anyway! =) )Increase the counter.
If i press back it still increases the counter!!!
This is the result from echoing:
1st run(page 0) :
I get nothing..logical as variables arent set yet
Pressing next(page 1):
Code: Select all
+1bbPressing next(on page 1 to 2)
Code: Select all
+11bbPressing back (on page 2 to 1)
Code: Select all
+12bbAnd so on....
Can anybody help me sort this out?...