added code for handling subpages for data, inserting in database. close.