Jump to content


display email address from search query and email

  • Please log in to reply
2 replies to this topic

#1 nelquintin

  • Members
  • PipPipPip
  • Advanced Member
  • 46 posts

Posted 14 August 2006 - 04:08 PM

i want to develop a site where i can email certain clients infomation.i already have the search and display option working.when a new product comes on the market i want to email only the clients which came up in the searh query.So say for instance all the clients name and email address are displayed on a page ,how do i gather the email on that page and send the product via php.

#2 shocker-z

  • Members
  • PipPipPip
  • Advanced Member
  • 864 posts
  • LocationNottingham

Posted 14 August 2006 - 04:14 PM

It depends on how you pull all the data into the page really.. if your pulling it in from a database then you might as well add the mail() function into the loop and email each users as it loops thru your query..

Another way would be to put a tick box by your results like

<inpute type="checkbox" name="emailaddress[]" value="<?php echo $row['emailaddress']; ?>">

And then a email now button at the bottom of the page and then on the page it submits too do

foreach ($_POST['emailaddress'] as $email) {
//put all info needed inside mail below using $email for the recipients address

just a breif of ideas..

www: www.ukchat.ws | irc: irc.ukchat.ws chan: #blufudge

#3 nelquintin

  • Members
  • PipPipPip
  • Advanced Member
  • 46 posts

Posted 15 August 2006 - 09:07 AM

Thanks for that maybe i can take a diffrent approach.The site for a estate agency what i want to do is get a property from the site and match all the clients in my database to that property and then email that spefic property to those clients.I have added my code in if it helps.Your help in this is much appricated.
This is how i pull up the propertys:

$search = $_POST["search"];
$query = "SELECT * FROM propertys WHERE ref LIKE '%".$_POST['search']."'";
$result = mysql_query($query);

if (mysql_num_rows($result)) {
    while ($row = mysql_fetch_array($result)) {
        $picture = $row["picture"];
        $minprice = $row["minprice"];
    $maxprice = $row["maxprice"];
$price = $row["price"];
        $ref = $row["ref"];
        $type = $row["type"];
        $erf = $row["erf"];
        $size = $row["size"];
        $bed = $row["bed"];
        $bath = $row["bath"];
        $gar = $row["gar"];

echo "<image src=\"$picture ","\" style=\"border: 2px solid black;\"><br><br>";
echo "<br> $ref <br> $price <br> $type <br> $erf <br> $size <br> $bed <br> $bath <br> $gar <br>";

I pull up the clients in a similar way.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users