473,670 Members | 2,527 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Troubles having PHP send database table info to an email address

2 New Member
Hello there,
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
  1. <?php
  2.   $my_result = $_POST['myData'];
  3.  
  4. $my_result = mail( "sales@longbeachclothing.com", "LBC Site Inquiry: $clientSubject", 
  5. "From: ".$clientName . "
  6. Email: ".$clientEmail. "
  7. Subject: ".$clientSubject. "
  8. Message: ".$clientMessage, "From: $clientEmail" );
  9. ?>
  10.  
  11. Here is my current code. There are two files.
  12. The first is called insert.php
  13. <?php
  14. ini_set('display_error',1);
  15. ?>
  16. <?php
  17. $connection = mysql_pconnect("localhost","longbeach562","40403141") or die('Could not connect: ' . mysql_error());
  18. mysql_select_db("longbeach562", $connection) or die('Could not select database' . mysql_error());
  19. ?>
  20. <?php
  21. $_name = $_REQUEST['name'];
  22. $_email = $_REQUEST['email'];
  23. $_subject = $_REQUEST['subject'];
  24. $_comments = $_REQUEST['comments'];
  25.  
  26. if ($_name != '' && $_subject != '') {
  27. //if ($_name != '') {
  28.     $SQL = "INSERT INTO `userInfo` (`name`, `email`, `subject`, `comments`) VALUES ('$_name', '$_email', '$_subject','$_comments');";
  29.     mysql_query($SQL) or die('Query failed: ' . mysql_error());
  30.     echo("&success=Thank you, your info has been received.");
  31. } else {
  32.     echo("&success=Some of your info is missing!");
  33. }
  34. ?>
  35.  
  36. This second on is called select.php:
  37. <?php
  38. ini_set('display_error',1);
  39. ?>
  40. <?php
  41. $connection = mysql_pconnect("localhost","longbeach562","40403141") or die('Could not connect: ' . mysql_error());
  42. mysql_select_db("longbeach562", $connection) or die('Could not select database' . mysql_error());
  43.  
  44. // no problems so query the db
  45. $SQL = "SELECT * FROM userInfo;";
  46. $result = mysql_query($SQL) or die('Query failed: ' . mysql_error());  
  47. ?>
  48. <?php
  49. $output = "<table border=\"1\">\n" . 
  50.     "<tr>\n" .
  51.     "<td>Id</td>\n" .
  52.     "<td>Name(s)</td>\n" .
  53.     "<td>Email(s)</td>\n" .
  54.     "<td>Subject?</td>\n" .
  55.     "<td>Comments</td>\n" .
  56.     "<td>Date & Time</td>\n" .  
  57.     "</tr>\n";
  58.  
  59. while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
  60.     $id = $row[0];
  61.     $name = $row[1];
  62.     $email = $row[2];
  63.     $subject = $row[3];
  64.     $comments = $row[4];
  65.     $date = $row[5];
  66.     $output .= "\t<tr>\n" .
  67.         "\t\t<td>$id</td>\n" .
  68.         "\t\t<td>$name</td>\n" .
  69.         "\t\t<td>$email</td>\n" .
  70.         "\t\t<td>$subject</td>\n" .
  71.         "\t\t<td>$comments</td>\n" .
  72.         "\t\t<td>$date</td>\n" . 
  73.         "\t</tr>\n";
  74. }
  75.  
  76. $output .= "</table>\n";
  77. ?>
  78. <?php echo($output) ?>
  79. <?php
  80. mysql_free_result($result);
  81. ?>
  82. </body>
  83. </html>
Sep 2 '06 #1
0 2249

Sign in to post your reply or Sign up for a free account.

Similar topics

0
9870
by: James Hong | last post by:
Help please, I try to sending an email from my html page using the java applet. but it give error on most of the PC only very few work, what is the error i make the java applet show as below ********************************** package Celcom.Client;
1
4193
by: David Thompson | last post by:
Looking for a book to help me develop a philosophy for building databases (particularly on MySQL). And then taking them from concept to construction. Something like.... Start by asking which queries you will be performing, then define all data needed for each of those queries, then progress to normalize this data, etc. Any Ideas....thanks...
2
1615
by: jlibster | last post by:
Hi, I wonder if someone can answer a quesiton for me: I'm modifying a database with the purpose of adding the new feature of address change history. My model would consist of a table for keeping client name/logon (for a public site) info in one table, and address info in another table because the login info would likely be more frequently accessed/changed than address updates. Now a group that does data entry internally through a web...
6
11175
by: DigitalRick | last post by:
I have been running CDONTS in my ASPpages to send emails to me sent from my guestbook. It had been working fine untill I upgraded to Server 2003 (I am also running Exchange 2003) all locally. I will include the code I originally used. I understand I should switch from CDONTS to CDO mail but after several sttempts I am finding a very hard time getting the new CDO mail to work properly. Any assistance with this would be greatly...
4
1785
by: A Palmblad | last post by:
We're having a lot of trouble with one of our new servers. It's an AMD64 dual cpu system, running on Gentoo Linux, with kernel 2.6.7. Data is stored on a JFS partition. Before we installed the server, memory was fully tested and no problems were found. Postgres is version 7.4.3. We've had a number of different errors. One of the most popular seems to be a Cannot open segment. This usually occurs on an index, generally the primary...
9
3110
by: sellcraig | last post by:
Microsoft access 2 tables table "data main" contains a field called "code" table "ddw1" is created from a make table query of "data main" Goal- the data in "code" field in needs to be inserted into a standard web address in the table (the filed name is link) in ddw1 Example address ---
0
8657
southoz
by: southoz | last post by:
Good ay all , I'm fairly new to access(a little over 5 weeks now). Since I'v started I have picked up a lot of useful information from forums such as this and in doing so will share that information with others. I have seen many request for information on mail merging an how to send data to word documents this is something I have put together with the answers given by others and I hope this will help a few newbies , I know there are easier ways...
2
3566
by: rustyc | last post by:
Well, here's my first post in this forum (other than saying 'HI' over in the hi forum ;-) As I said over there: ... for a little side project at home, I'm writing a ham radio web site in uby/Rails. I started it in Perl and gave up on Perl as I went from the 'display the database information on the web page' to the 're-display the information from the database and allow the user to update the database using the web page' stage and realized...
2
1493
by: adam87 | last post by:
Below is my code, what I have done is create a form which sends via asp, it works fine within IE but when testing it in Firefox the entire form is outside the page. Hope you can help! Adam Huxtable HTML FILE <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html;...
0
8466
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8384
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8896
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8810
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7410
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6211
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5683
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4387
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1790
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.