this script I copied from webmonkey doesn't work 100%.

From what I can tell, the isset function is always evaluating to true.

It is only supposed to evaluate to true if the variable $begin is not included in the link URL.

As the link url seems to be generated properly (i think?) later in the script , the isset(!$begin) should evaluate to true and the $begin variable should be available to the script to use. Right?

If someone can find any error, I would be very grateful.

Code file attached

🙂

    are u able to see the value of begin in the url link, something like
    your_page.php?begin=1

    reg
    kevin

      .
      .
      .
      .
      <div align="center">
      		<?PHP
      		//print out navigation links
      		if(($begin == 0) && ($next_begin < $total_photos)){
      
      	//you are at the beginning of the photo gallery
      
      	?>
      	  <font face="arial, helvetica" size="2">
      	  <b><a href="view.php?begin=<?PHP print($next_begin);?>">next page</a>
      	  <font color="#FF0000">&#187;</font></b>
      	  </font>
      	<?PHP
      	}
      	elseif (($begin > 0) && ($next_begin < $total_photos)){
      
      	//you are in the middle of the photo gallery
      
      	?>
      	  <font face="arial, helvetica" size="2">
      	  <b><font color="#FF0000">&#171;
      	  </font> <a href="view.php?begin=<?PHP print($prev_begin);?>">prev page</a></b></font>
      	  <b>|</b>
      	  <font face="arial, helvetica" size="2">
      	  <b><a href="view.php?begin=<?PHP print($next_begin); ?>">next page</a>
      	  <font  color="#FF0000">&#187;</font></b></font>
      	<?PHP
      	}
      	elseif(($begin == 0) && ($next_begin > $total_photos)){
      
      	//you are in a photo gallery with only one page of photos
      
      	?>
      
      	<?PHP
      	}
      	else {
      
      	//you are at the end of the photo galley
      
      	?>
      	  <font face="arial, helvetica" size="2">
      	  <b><font color="#FF0000">&#171;</font>
      	  <a href="view.php?begin=<?PHP print($prev_begin); ?>">prev page</a></b></font>
      	<?PHP
      	}
      	?>
      .
      .
      .
      

      reg
      kevin

        without the $ is how I had it the first time.

        I changed it back and got the sam problem.

        Do I need to do something special to get the "begin=20" into the script so that the variable $begin gets updated to 20?

        And which isset syntax should I be using
        1. if(!isset($begin)){ //in the script originally

        or

        1. if(!isset($_GET['$begin'])){ //something i tried to fix the script with.

        attached is the original script from webmonkey unaltered by my troubleshooting

        Thanks

          Write a Reply...