Question about doing something in PHP?

I'm trying to create a back and forward button for a page that shows different comics. The way I have it now has one page with a name list, like:

Comic 1
Comic 2
Comic 3

So when you click on one, it assigns the state as state=1 or whatever. Now on the page where the comic is displayed I want to have a back and forward button to navigate between them without having to go back to the list page. I'm assuming I have to do something in php where I 'get' the state and say -1 or +1 but I don't know what the code would look like. So I want something like this:

<a href="comics.php?state= <?php ($_GET['state']-1) ?>">Back</a>

But in proper code. Any ideas?
Looks like I'm doing it a bit differently. I got all the comics on the same page (comics.php), so to display the right comic I'm using the case function like this:

switch($_GET['state'])
{
case "1":
*display comic 1*
break;

case "2":
*display comic 2*
break;

And now I'm trying something like this:

<a href="test2.php?state=

<?php
$num = $_GET['state'];
$num = $num - 1;
?>
">back</a>

<?php

But when 'back' is clicked in results in the state being blank. I'm not even sure if that is proper coding. Is there another way to do this using a single php page?
 
Back
Top