Jump to content


This topic is now archived and is closed to further replies.


display email address from search query and email

Recommended Posts

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.

Share this post

Link to post
Share on other sites
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..


Share this post

Link to post
Share on other sites
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.

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.