You could store the number in a database or a flat text file.
Here is some info on text files...
http://us3.php.net/manual/en/function.fopen.php
you'll also want to read on fclose, fread, fwrite. Then all you need to increment the number is
$num = ($num + 1);
If you need more let me know. If you want to go with a database, you have even more reading to do...