Posting to various Emails via other information + database

Hey there
Firstly I would like to implement a Form Mailer script that sends data to a database (preferably MySQL) plus sends to an email address.

Now here’s the twist. The Formmail can’t be just sent to one email. It will need to be sent off to different emails depending on what other information is inserted into the Form.

In my example, it’s a postcode. Let’s say someone puts in the postcode ‘6010’ - it will be sent off to [email protected]. If someone puts a postcode of ‘60939’ - it will be sent to [email protected]. The examples are irrelevant here - just the principle of the form’s infomration to be sent to differing emails depending on ‘postcode’ infomration given. For ‘postcodes’ that aren’t listed, they will be sent off to a default email address.

I’m assuming I need to set up a database for this infomration as well.

How would I go about building the script that would submit info to
a) a database
b) various emails depeding on ‘other’ infomration submitted on the form

I hope this hasn’t been too verboise. Thanks alot for ur help.