I am trying to create a next/back navigation menu for a series of pages. Using the following variable definition, the variable increments fine... The number I am operating on is an automatically generated number from a MySQL database. The number leads with three zeros.
$next = (++$id_num) ;
this will increment a number like 00040 to 00041 fine.
However when I try the reverse,
$back = (--$id_num) ;
The number that is returned is stripped of its leading zeros. As this number is included in a URL, I need them.
How can I reduce a variable in number as I have increased it above and not strip the zero's. The code is as follows....
<a href="/pages.php?id_num=<?php printf($back);?>">Back</a>
| <a href="/pages.php?id_num=<?php printf($next);?>">Next</a><br>
Any help would be most appreciated.
Thanks