Technically you are using a database. A database is a generic term for a
collection of (related) records whether it be Access, MySql or Oracle or a
basic character delimited text file. (CSV file - character separate values).
My answer may seem complicated, and a bit of a mix of ideas, but it is how I
see you reaching a solution to this problem.
You'll need a database of some description, and a server side script to
generate and track the numbering of the Receipts, since javascript won't
work as it is a client-side language.
eg if User A submits the form and generates '0001' as the receipt, and
User B does the same, the javascript is going to generate 00001' for User B
as well (since the script runs on the user's computer, not from the server
hence the term "client-side"), instead of '00002' since 00001 has been used
by User A. (if that makes sense).
The javascript running on User B won't know that User A has already
submitted data on the form and received 00001 as their receipt number.
However a server side script would be able to track this, and generate the
numbers sequentially, so it would realise User A submitted the data and
allocated '0001' to User A then user B would submit data and the script
would check the DB and increment to the next available number in the
sequence -allocate '0002' as the receipt for User B
Therefore it seems a server side script and database will be necessary to
achieve this.
One possible solution to use would be the suite of scripts at this site,
http://www.ezscripting.com, which has some excellent but simple database
utilities: including submitting data to the db through a form, edit, delete
and amend scripts to manipulate the data. Also allows for emailing the
submission to a chosen email address - email address is specified within the
script which helps prevent spammers making multiple submissions using the
form and therefore contaminating your db with useless crap.
They take a bit of setting up, a very basic knowledge of CGI/Perl would
help, but there are comprehensive instructions, and a help forum should you
have trouble.
One thing these scripts do, is they generate record numbers, which you could
use as the receipt number.
They also are template-based and so the pages are not generated by the
script, but the data is placed into an html page based on the place-holders
of the field names -this allows you to design the template pages to fit your
site's design.
See
http://www.soundsofthepipes.net and go to the Repertoire page for an
example of these scripts in action.
These scripts might be overkill for your requirements, but these scripts use
ASCII text files for the database(s), nothing more, and requires Perl on a
Linux server.