Ok, I looked more deeply at the problem area (the next and previous links). Let me visually show you what the problem is. We have two if statements (you say there's more, but these 2 are the only ones that have to do with the problem):
PHP Code:
if ($_GET['mode']=='gallery'){...}
if ($_GET['mode']=='picture'){...}
Now, you're making the $pageNum variable in the first if statement, if mode=gallery. Then, you're trying to use $pageNum again in the second if statement, if mode=picture. Now, if anything in mode=picture is being processed, that means that mode does not = gallery, it = picture...so anything done in mode=gallery is ignored. Therefore, the variable $pageNum is being ignored in the second if statement.
To fix this, I'd do the $pageNum thing OUTSIDE of the if statements, before both of them, at the top. If you do this and for some reason there's still a problem, echo the variables being used as a test to make sure they have values. Mess around with stuff until it works. If stuff is still messed up, feel free to post your new code and I'll take a look at it.
Also, I saw some minor issues in the code. In both Next and Previous links, I see you using the < and > symbols. To follow guidelines and stuff, you should use the codes for those: < for < and > for >. So it would look like:
Also, remember what I said about the if, if else, and else statements: they're better for organization. It's simple logic.
If THIS do THIS
Else if THIS do THIS instead
Else (if the top things do not apply) do THIS
So, simple example:
PHP Code:
if($fruitColor == 'red'){ echo '<p>You have an apple!</p>';}
else if($fruitColor == 'yellow'){ echo '<p>You have a banana!</p>';}
else if($fruitColor == 'orange'){ echo '<p>You have an orange!</p>';}
else{ echo '<p>You do not have an apple, a banana, or an orange!</p>';}
Anyway, multiple if's will still work, but the organized if, else if, else statements make more sense...it groups the statements together, really, and makes reading/understanding your code a lot easier. Fix the pagination issue, then worry about organization...it'll improve these types of situations drastically!
Bookmarks