in reply to hidden fields

Although you asked how to do this with hidden fields, you could use a cookie. Using CGI.pm, the cookie function can handle hashes with very little gymnastics on your part.