Posted 13 July 2006 - 03:23 AM
Posted 13 July 2006 - 03:28 AM
you insert data into database,
then after that, compose an email and send.
Posted 13 July 2006 - 03:36 AM
I was wondering if it is possible to insert data from a form into my database and have the data be sent via email at that same time? I have no trouble doing either on there own, but combining the two is where I'm lost.
Yes, it possible to insert data into a database and email what it inserted within the same script. You might have an SQL statement:
<?php $sql="INSERT INTO myTable (id, name, address, city, state, zip) VALUES(null, '".$name."', '".$address."', '".$city."', '".$state."', '".$zip."' )"; mysql_query($sql); ?>
All you need is to send the mail (assuming your PHP has mailing enabled).
<?php $to = 'firstname.lastname@example.org'; $subject = 'the subject'; $message = "$name $address $city $state $zip"; $headers = 'From: email@example.com' . "\r\n" . 'Reply-To: firstname.lastname@example.org' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); ?>
The above was taken and then edited from php.net.
The above should insert the data into the database and send the values to you.
Posted 13 July 2006 - 03:54 AM
Posted 15 July 2006 - 07:05 AM
Posted 16 July 2006 - 11:37 AM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users