ok... so I don't have the greatest coding method I'm sure, but here's what I got. I'm displaying a catalog, named "DealerName1, Dealername2" etc. Clicking next brings you to the next page... but I'm trying to make it so that if it's an 8 page catalog it won't let you click to page 9 or a 16 page catalog clicking to page 17... (and not go back to page negative 1) so here's the code...
Code:
<?php
$dealername = "fuccillo";
$NumPages = 8;
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title><?php echo $dealername ?></title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="700" border="0" cellspacing="0" cellpadding="0" align="LEFT" valign="TOP">
<tr>
<td></td>
<td>
<table border="0" cellspacing="0" cellpadding="0">
<tr><td height="10" colspan="5"></td></tr>
<tr>
</tr>
<?
if (isset($_GET['PageNum'])) {
$setnum = $_GET['PageNum'];
?>
<td align="left" width="10">[img]images/backArrow.gif[/img]</td>
<td align="left"><a class="redlink" href="index.php?PageNum=
<? $setnum = $setnum-1;
if ($setnum > 1) {
echo "";
} elseif ($setnum >= 0) {
echo "";
} else {
echo $setnum;
}
?>"> BACK <? echo $setnum; ?></a></td>
<td align="center">VIEW AS PDF</td>
<td align="right"><a class="redlink" href="index.php
<? if ($setnum >= 9) {
echo "";
} else {
$setnum = $setnum+1; } echo "?PageNum="; echo $setnum ?>">NEXT </a></td>
<td width="10">[img]images/nextArrow.gif[/img]</td>
<tr>
<td height="5" colspan="5"></td>
</tr>
<tr>
<td align="center" colspan="5">
<script>
document.write("[img]images/<?php echo $dealername ?><?php $setnum = $setnum-1; echo $setnum ?>.jpg?"+Math.random()+"[/img]")
</script>
</td>
</tr>
</table>
<? } else { ?>
<td width="10">[img]images/backArrow.gif[/img] </td>
<td align="left" class="regularGrey">BACK</td>
<td align="center" class="regularGrey">VIEW AS PDF</td>
<td align="right">NEXT </td>
<td width="10">[img]images/nextArrow.gif[/img]</td>
</tr>
<tr>
<td height="5" colspan="5"></td>
</tr>
<tr>
<td align="center" colspan="5">
<script>
document.write("[img]images/salesflyer.jpg?"+Math.random()+"[/img]")
</script>
</td>
</tr>
</table>
<? } ?>
</td>
<td>[img]images/clearpixel.gif[/img]</td>
<td align="left" width="250" valign="top">
<table width="250" border="0" cellspacing="0" cellpadding="0" valign="top">
<tr>
<td height="1">[img]images/clearpixel.gif[/img]</td>
</tr>
<tr>
<td width="250" height="61" valign="top">[img]images/instruct.gif[/img]</td>
</tr>
<tr>
<td class="regularsm">
<? include_once "nav.php"; ?>
</td>
</tr>
</table>
</td>
</tr>
<tr>
</tr>
</table>
</body>
</html>
The "Back" snippet seems to work... but I can't seem to get the "Next" to work correctly... and I know that my $NumPages = 8; isn't actually doing anything at this second, trying to make it work with with hardcoded number before I use that... any help is appreciated