Forum Moderators: coopster

Message Too Old, No Replies

How would I do this?

Send an email with the same info that has been entered into mysql db.

         

LegacyCX

7:40 pm on Apr 1, 2004 (gmt 0)

10+ Year Member



Hello,

I'm writing a small (my first script) script that takes info form a visitor (name, email, address, city, state) and inserts it into a mysql database. Afterwards, we export the database into cvs format and use it to make labels etc.

What we would like to do is besides having the info added to a mysql db, have that SAME information emailed to us so we know someone signed up.

Could this be done in 1 shot? meaning, have the script ADD the info the DB AND have it the email sent out?

Thanks

lorax

8:11 pm on Apr 1, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Greetings and welcome to WebmasterWorld.

What you'll need to do.

[your MySQL insert code here]

Then use the PHP mail() [php.net] function and fill in the options with the same vars you used to submit to your MySQL database.

LegacyCX

8:16 pm on Apr 1, 2004 (gmt 0)

10+ Year Member



Hey. Thanks.

I'll have to try it when I get home.

So I can use a seperate mail command.. very basic and use $POST_[$lname] to grap the variables from the form?

lorax

8:15 pm on Apr 2, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Yup. PHP will execute the script from top to bottom so the INSERT will be executed first and then the mail routine. Now, if you want to be adventurous you'd teach yourself how to determine if the INSERT query failed and have the script email you the error instead of the form vars! ;)