943,788 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 505
  • PHP RSS
Jul 14th, 2009
0

How do get email from database?

Expand Post »
Hello Guys,

I would like to know if its possible or not, where i can have a text box which when i enter the ID and press submit it gets the email matching that ID. and sends an email, please note that i know how to send email, i just dont know how to get data and send it can someone please give me an example on how i would do this. THank you

Have a good day
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
NoID is offline Offline
49 posts
since Jul 2009
Jul 14th, 2009
0

Re: How do get email from database?

I'm not sure what you need: the HTML form, the SQL statement or the PHP to run it? or do you just want to pass?
Reputation Points: 49
Solved Threads: 22
Junior Poster
Menster is offline Offline
175 posts
since Jun 2009
Jul 14th, 2009
0

Re: How do get email from database?

Hello,

I have a form when everytime i fill, it gives a unique id for example

name
surename
address
postcode
email@email.com
ID: 4

name
surename
address
postcode
email1@email.com
ID: 5

name
surename
address
postcode
email2@email.com
ID: 6

I then want a text box on say page called email.php

is like this

----------------
5 |
--------------- submit

when i click on submit, it goes to server and finds the email for record 5 and sends an email.

I hope that makes sense, thank you

have a good day
Reputation Points: 10
Solved Threads: 0
Light Poster
NoID is offline Offline
49 posts
since Jul 2009
Jul 14th, 2009
0

Re: How do get email from database?

php Syntax (Toggle Plain Text)
  1. <?php
  2.  
  3. if($_POST['submit'] == "Send Email")
  4. {
  5. $sql = "Select * from tablename where id=".$_POST['id'];
  6. $res = mysql_query($sql);
  7. $data = mysql_fetch_array($res);
  8.  
  9. $to_email = $data['email'];
  10.  
  11. //Send mail here
  12. // mail($to_email,$subject,$msg);
  13. }
  14.  
  15. ?>
  16. <form name="frmEmail" action="" method="post">
  17. <input type="text" name="id" id="id" />
  18. <input type="submit" name="submit" id="submit" value="Send Email" />
  19. </form>
Last edited by sikka_varun; Jul 14th, 2009 at 9:36 am. Reason: Changing $_SUBMIT to $_POST
Reputation Points: 11
Solved Threads: 12
Junior Poster in Training
sikka_varun is offline Offline
94 posts
since Dec 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: PHP Formula and syntax
Next Thread in PHP Forum Timeline: web crawler





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC