Reply to topic
How do you post form info to both mysql and email recipient
jd1245


Joined: 10 Oct 2007
Posts: 2
Location: Delaware
Reply with quote
I need to be able to send form submission to email recipient and back up that same info in a mysql database. I know how to do each one separately.
Jason101
Forum Regular

Joined: 14 Mar 2006
Posts: 570
Location: Harrisburg, PA
Reply with quote
It can be done easily. What language you are using?
jd1245


Joined: 10 Oct 2007
Posts: 2
Location: Delaware
Reply with quote
php
nathacof
Forum Admin

Joined: 24 Oct 2006
Posts: 192
Location: Dover, DE
Reply with quote
You would store the data in a variable, then use the variable to send the data to the database server, then use the variable to send an email.

http://us3.php.net/mysql
http://us3.php.net/manual/en/tutorial.forms.php
http://www.php.net/links.php

Here's a mock up:

Code:

<?php
$data = $_POST['data'];
$db = mysql_connect($host, $user, $password)
mysql_query("INSERT INTO table (data) VALUES ($data)", $db)or DIE("Could not insert $data");

$mailData = "$data inserted into database";

mail('me@example.com', 'Query Results!', $mailData) or DIE ("Could not send email!");
?>
How do you post form info to both mysql and email recipient
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT  
Page 1 of 1  

  
  
 Reply to topic