fundraising form submit to database then to paypal

I have modified the form so that I can have additional fields to fill out, but I can't figure out how to modify the javascript so that it successfully submits the form to a database table before redirecting to paypal. Any suggestions or advice would be helpful.