PDA

View Full Version : Posting to various Emails via other information + database



ctdesign87
October 10th, 2006, 05:39 AM
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 perth@domain.com.au. If someone puts a postcode of '60939' - it will be sent to california@domain.com.au. 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.

bwh2
October 10th, 2006, 09:50 AM
a) you just need PHP to send SQL INSERT queries to a db. there are tons of tutorials on the web available. maybe some here.
b) there are also tons of emails that show how to make email forms with PHP. there's also one on kirupa.com.

you will basically throw (a) and (b) into the same PHP script and let it fly.

ctdesign87
October 11th, 2006, 12:07 AM
a) you just need PHP to send SQL INSERT queries to a db. there are tons of tutorials on the web available. maybe some here.
b) there are also tons of emails that show how to make email forms with PHP. there's also one on kirupa.com.

you will basically throw (a) and (b) into the same PHP script and let it fly.

hey thanks for that.
i know submitting the info to a mysql database is great, but it's (b) that i've got issues with.
i'm actually quite new to PHP so i need to have a hand to hold through this.

feedback would b greatly appreciated.

ctdesign87
October 11th, 2006, 05:00 AM
after some playing around, i've successfully implemented a script whereby a user inserts info into a form and its submitted to a mysql database and sent off to "an" email (ie. one recipient).

as i said before, i need that information to be sent off to different emails depending on what they insert in the form. so if its like '6035' it will be sent off to "email no. 1". if the user inserts "5323", it will be sent off to another email...and so on.

how can i go about doing this?