Script: (too large, didn't want to paste it and clutter this, sorry.)
http://pastebin.com/jhvgAqzj
Well, for some reason $p is acting very very weird, the $p is set to 1 and should add 1 to itself when the 'next' button is pressed. Inversely should subtract 1 from $p when the 'prev' button is pressed.
There are also 2 nested 'if' statements to prevent it from ever going over the max number or pictures, or under the min number of pictures.
$p is the variable used to display the picture according to its ID type.
For some reason, it will work until you get to picture 3, when you hit next, t开发者_运维知识库he variable jumps to 2. When you hit previous on 2, it jumps to 3.
This is very confusing but we laughed when we tested it.
Thanks for the help in advance!
When your page reloads, the value of $p
is reset back to 1
every time. In order to remember which number $p
was on the last post, you should use a session.
session_start();
$_SESSION['p'] = 1;
Then, if the post value is set, you can reference your session to retrieve the value of p on your last page load.
精彩评论