I too am having a somewhat similar problem and would very much appreciate some assistance. Through PHP, I have already set up my Flash actionscript to pass info and variables onto a MySQL database that is functionable in retrieving user info (name, email, subject, and comments). My only problem is that I need to have the information that the user sends when the click submit to also send an email to the owner with the same info. He wants to get an individual email for each individual who inputs their info and hits submit.
I was trying to derive something from this code to get it to work, but nothing seemed to work:
Expand|Select|Wrap|Line Numbers
- <?php
- $my_result = $_POST['myData'];
- $my_result = mail( "sales@longbeachclothing.com", "LBC Site Inquiry: $clientSubject",
- "From: ".$clientName . "
- Email: ".$clientEmail. "
- Subject: ".$clientSubject. "
- Message: ".$clientMessage, "From: $clientEmail" );
- ?>
- Here is my current code. There are two files.
- The first is called insert.php
- <?php
- ini_set('display_error',1);
- ?>
- <?php
- $connection = mysql_pconnect("localhost","longbeach562","40403141") or die('Could not connect: ' . mysql_error());
- mysql_select_db("longbeach562", $connection) or die('Could not select database' . mysql_error());
- ?>
- <?php
- $_name = $_REQUEST['name'];
- $_email = $_REQUEST['email'];
- $_subject = $_REQUEST['subject'];
- $_comments = $_REQUEST['comments'];
- if ($_name != '' && $_subject != '') {
- //if ($_name != '') {
- $SQL = "INSERT INTO `userInfo` (`name`, `email`, `subject`, `comments`) VALUES ('$_name', '$_email', '$_subject','$_comments');";
- mysql_query($SQL) or die('Query failed: ' . mysql_error());
- echo("&success=Thank you, your info has been received.");
- } else {
- echo("&success=Some of your info is missing!");
- }
- ?>
- This second on is called select.php:
- <?php
- ini_set('display_error',1);
- ?>
- <?php
- $connection = mysql_pconnect("localhost","longbeach562","40403141") or die('Could not connect: ' . mysql_error());
- mysql_select_db("longbeach562", $connection) or die('Could not select database' . mysql_error());
- // no problems so query the db
- $SQL = "SELECT * FROM userInfo;";
- $result = mysql_query($SQL) or die('Query failed: ' . mysql_error());
- ?>
- <?php
- $output = "<table border=\"1\">\n" .
- "<tr>\n" .
- "<td>Id</td>\n" .
- "<td>Name(s)</td>\n" .
- "<td>Email(s)</td>\n" .
- "<td>Subject?</td>\n" .
- "<td>Comments</td>\n" .
- "<td>Date & Time</td>\n" .
- "</tr>\n";
- while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
- $id = $row[0];
- $name = $row[1];
- $email = $row[2];
- $subject = $row[3];
- $comments = $row[4];
- $date = $row[5];
- $output .= "\t<tr>\n" .
- "\t\t<td>$id</td>\n" .
- "\t\t<td>$name</td>\n" .
- "\t\t<td>$email</td>\n" .
- "\t\t<td>$subject</td>\n" .
- "\t\t<td>$comments</td>\n" .
- "\t\t<td>$date</td>\n" .
- "\t</tr>\n";
- }
- $output .= "</table>\n";
- ?>
- <?php echo($output) ?>
- <?php
- mysql_free_result($result);
- ?>
- </body>
- </html>