GRQNET
|
Posted: 05/29/2003, 10:16 PM |
|
I would like to be able to email a subset of members in my database after a
form is submitted.
I want the subset of members filtered by a field in the form that is
submitted.
The form that gets filled out looks something like this:
Name:
Address:
City:
State:
Zip:
Catagory:
The catagory's can vary, such as: music, art, math, etc...
In the member table I have a field called "desired_catagory" which the
member entered their catagory preference such as "music" for example.
If a user fills out the form and enters a catagory of "music", I would like
this form emailed to ALL the matching members in the members table that have
selected "music" in their desired_catagory.
I am using CodeCharge Studio with ASP coding linking to my database called
Membership.mdb
The table that contains the member information is called members.
Any help is appreciated.
Thanks.
Anthony :)
|
|
|
RonB
|
Posted: 06/02/2003, 5:15 AM |
|
Oke, I dont know any asp so I'll explain it with php but the proces will be
the same in ASP:
here's my after update event(this page recides in the admin section and
updates a record with newsletters, setting one field to newsletter is send,
after the update it selects subscribers from a different table and stores
their email adresses in an array then sending an prebuild email to each of
the adresses in the array );
global $NewRecord2;
//creating a new connection class for the query
$db = new clsDBConnection1();
//gettting all email adresses with the news_sub_send option 1 meaning "I
want to receive your newsletter"
$db->query("select news_sub_id,news_sub_email from newsletter_subscriptions
where news_sub_send=1");
//storing them in an array and sending the emails
while ($db->next_record())
{
$a=Array();
$a["email"]=$db->f("news_sub_email");
$a["id"]=$db->f("news_sub_id");
$mailtext="We have just published a new edition of our newsletter. To
view your copy please click on the link provided.:\n\n"
."http://www.my_client's_site.com/newsletter.php\n\n"
."Thanks,\n\n"
."Metallique\n\n\n\n"
."You are receiving this newsletter because you registered your email at
our site. \n\n"
."If you do not wish to recieve these notifications you can unsubscribe
by clicking this link: \n\n"
."http://www.my_client's_site.com/unsubscribe.php?id=" .$a["id"];
$mailto=$a["email"];
$mailsubject="Metallique Bijoux Newsletter Notification";
mail($mailto,$mailsubject,$mailtext);
}
So basicaly it's getting the email adresses and walking thrue the array
sending an email for each entry.
Ron
"GRQNET" <Webmaster@grq.net> schreef in bericht
news:bb6pfc$r22$1@news.codecharge.com...
> I would like to be able to email a subset of members in my database after
a
> form is submitted.
> I want the subset of members filtered by a field in the form that is
> submitted.
>
> The form that gets filled out looks something like this:
>
> Name:
> Address:
> City:
> State:
> Zip:
> Catagory:
>
> The catagory's can vary, such as: music, art, math, etc...
>
> In the member table I have a field called "desired_catagory" which the
> member entered their catagory preference such as "music" for example.
>
> If a user fills out the form and enters a catagory of "music", I would
like
> this form emailed to ALL the matching members in the members table that
have
> selected "music" in their desired_catagory.
>
> I am using CodeCharge Studio with ASP coding linking to my database called
> Membership.mdb
> The table that contains the member information is called members.
>
> Any help is appreciated.
>
> Thanks.
>
> Anthony :)
>
>
>
|
|
|
|