Dynamic select list selected item

I have an order form page with quite a few select lists (about 40), all of them hold values from 0 - 20.

They are basically on an order form, for ordering prints from an uploaded image.
There are 40 product options (sizes and materials), and by each product is a select box for the quantity 0 - 20.

I want the user to be able to select the number of prints for an image and choose the products they require.

Clicking the submit button will insert their choices into a mySQL db.

Here is the form…

http://www.tiberi.com.au/orders/order_popup.html

Now, what I need to know is how best to dynamically make the options selected from the data in the database if the user comes back to this order page?

I hope this makes sense! I’m a newbie when it comes to php!