So I have a script that includes forms that are stored in files named like 0101, 0102, and the next category would be 0201, 0202, 0203. The first two set of numbers are the category, second set are the pages in for the forms.
The problem I am having with this numbering is that I am storing the number as 0101 or 0205 and since the first number is only a non-existent thing, 0, it seems to be knocking it off. The only way I managed to actually make it work in some messy way was to do something like this:
"planpages/0" . $nextcat . ".php"
Where $nextcat might be 203. It doesn't seem to like the 0 in front of anything, and must be stored in a string which has something before it (in the case above, you have a "/" sign).
How do I solve the problem with data loss? I did try looking it up in other places, but I didn't know what to put in for the query.
EDIT: More code.
The number is originally stored in $_GET['content'], passed to nextForm($current).
function nextForm($current) {
$next = $current[0] . $current[1] . $current[2] . $current[3] + 1;
$nextcat = $current[0] . $current[1] + 1 . 0 . 1;
if(file_exists("planpages/0" . $next . ".php")) {
return "0" . $next;
} elseif(file_exists("planpages/0" . $nextcat . ".php")) {
return "0" . $nextcat;
} else {
return $current;
}
}
Hopefully that is more information needed. It looks like a mess because I tried my hardest to keep those zeros, but they keep disappearing.
0is non-existant to you.