you could just put the elements into a hidden form (using <input type="hidden" name="foo" value="bar">) to pass them along to yet another page which does the insertion into the database. The "button" you speak of would now become a form submit button.
Then, you could also have that second page do a re-direct to another page, if you so desire. It probably should, so that you don't run into the reload problem where people mistakenly insert the data twice or more because they reload that page.