This is a multi-part message in MIME format.
------=_NextPart_000_035F_01BFC677.D3146400
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
I am trying to use CFIF in a mailing list application to do a few =
things.
In this case, I want the page to first check if the user is subscribing =
and
if so, then check the database for the email. If the email doesn't =
already exist,=20
it is added to the database and a confirmation is displayed OR if the =
email
does exist, a message is displayed. It works fine for the "Add" section, =
but when
it comes to the "Remove" section (which is the same logic), it displays =
a blank
page if the email doesn't exist in the database. (It works if the email =
is in
the database). Here's the entire code:
<CFPARAM NAME=3D"Form.Email"> <CFPARAM NAME=3D"Form.Subscriber">
<CFPARAM NAME=3D"Form.Subscribe"> <!--- Subscribe values =3D "Add" or =
"Remove" --->
<!--- Subscribe user to the mailing list --->
<CFIF "#Form.Subscribe#" IS "Add">
<!--- Query database for Email address submitted on form --->
<CFQUERY NAME=3D"CheckSubscribers" DATASOURCE=3D"GFMaillist1">
SELECT * FROM Subscribers
WHERE Email =3D '#Form.Email#'
</CFQUERY>
<!--- Check if Email on the form already exists in database----->
<CFIF #CheckSubscribers.Email# IS "#Form.Email#">
<!--- If email already exists, display this message --->
<CFOUTPUT>Your email #Form.Email# already exists in the =
database.</CFOUTPUT>
<!--- If email doesn't exist, add to the database and send mail--->
<CFELSE>
<!--- Add user to the database--->
<CFQUERY NAME=3D"AddNewSubscriber" DATASOURCE=3D"GFMaillist1">
INSERT INTO Subscribers (Subscriber, EMail)=20
VALUES ('#Form.Subscriber#', '#Form.EMail#')
</CFQUERY>
<CFOUTPUT><b>Your email #Form.Email# has been successfully added to the =
mailing list!</B></CFOUTPUT>
<!--- Send Email confirmation that they have been added --->
<CFMAIL SERVER =3D"mail.paconline.net" PORT=3D"25" To=3D"#Email#" =
FROM=3D"[EMAIL PROTECTED]" SUBJECT=3D"Welcome to the Newsletter!">
Welcome message..
</CFMAIL>
</CFIF></CFIF>
<!--- Remove Subscriber from the mailing list ---->
<CFIF #Form.Subscribe# IS "Remove">
<!-- Check database for email address submitted on form --->
<CFQUERY NAME=3D"CheckEmail" DATASOURCE=3D"GFMaillist1">
SELECT * FROM Subscribers
WHERE Email =3D '#Form.Email#'
</CFQUERY>
<!--- If email exists, delete from mailing list----->
<CFIF #CheckEmail.Email# IS "#Form.Email#">
<CFQUERY NAME=3D"RemoveUser" DATASOURCE=3D"GFMaillist1">
DELETE FROM Subscribers WHERE Email =3D '#Form.Email#'=20
</CFQUERY>
<CFOUTPUT QUERY=3D"CheckEmail">
<B>Your email #Form.Email# has been successfully removed from the =
mailing list.</B>
</CFOUTPUT>
<!--- Send removal notification --->=20
<CFMAIL SERVER =3D"mail.paconline.net" PORT=3D"25" TO=3D"#Email#" =
FROM=3D"[EMAIL PROTECTED]" SUBJECT=3D"Goldenfly mailing list =
removal confirmation">
Removal message...</CFMAIL>=20
<CFELSE>
<!--- if email doesn't exist, display message --->
<CFOUTPUT>
<B>Your email <B>#Form.Email#</B> does not exist in the database.</B>
</CFOUTPUT>
</CFIF></CFIF>
Any help would be appreciated.
thanks,
Kristin
[EMAIL PROTECTED]
------=_NextPart_000_035F_01BFC677.D3146400
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2614.3500" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>
<DIV><FONT face=3DArial size=3D2>I am trying to use CFIF in a mailing =
list=20
application to do a few things.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>In this case, I want the page to =
first check=20
if the user is subscribing and</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>if so, then check the database for the=20
email. If </FONT><FONT face=3DArial size=3D2>the email =
doesn't already=20
exist, </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>it is added to the database and a =
confirmation is=20
displayed OR if the email</FONT></DIV>
<DIV>does exist, <FONT face=3DArial size=3D2>a message is displayed. It =
works fine=20
for the "Add" section, but when</FONT></DIV>
<DIV>it comes to the "Remove" section (which is the same logic), it =
displays a=20
blank</DIV>
<DIV>page if the email doesn't exist in the database. (It works if =
the=20
email is in</DIV>
<DIV>the database). Here's the entire code:</DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2><CFPARAM NAME=3D"Form.Email"> =
<CFPARAM=20
NAME=3D"Form.Subscriber"><BR><CFPARAM NAME=3D"Form.Subscribe"> =
<!---=20
Subscribe values =3D "Add" or "Remove" ---><BR><!--- Subscribe =
user to the=20
mailing list ---><BR><CFIF "#Form.Subscribe#" IS =
"Add"><BR><!---=20
Query database for Email address submitted on form =20
---><BR> <CFQUERY NAME=3D"CheckSubscribers"=20
DATASOURCE=3D"GFMaillist1"><BR> =
SELECT *=20
FROM Subscribers<BR> WHERE Email =3D =
'#Form.Email#'<BR> </CFQUERY><BR><!--- Check =
if Email=20
on the form already exists in database-----><BR><CFIF=20
#CheckSubscribers.Email# IS "#Form.Email#"><BR><!--- If email =
already=20
exists, display this message ---><BR><CFOUTPUT>Your email =
#Form.Email#=20
already exists in the database.</CFOUTPUT><BR><!--- If email =
doesn't=20
exist, add to the database and send =
mail---><BR><CFELSE><BR><!---=20
Add user to the database---><BR> <CFQUERY =
NAME=3D"AddNewSubscriber"=20
DATASOURCE=3D"GFMaillist1"><BR> INSERT INTO Subscribers =
(Subscriber,=20
EMail) <BR> VALUES ('#Form.Subscriber#',=20
'#Form.EMail#')<BR> </CFQUERY><BR> <CFOUTPUT><b&=
gt;Your=20
email #Form.Email# has been successfully added to the mailing=20
list!</B></CFOUTPUT><BR><!--- Send Email confirmation =
that they=20
have been added ---><BR> <CFMAIL SERVER =
=3D"mail.paconline.net"=20
PORT=3D"25" To=3D"#Email#" <A=20
href=3D'mailto:FROM=3D"[EMAIL PROTECTED]'>FROM=3D"splashdesigns@home=
.com</A>"=20
SUBJECT=3D"Welcome to the Newsletter!"><BR> Welcome=20
message..<BR> </CFMAIL><BR></CFIF></CFIF></FONT></=
DIV>
<DIV><!--- Remove Subscriber from the mailing list ----></DIV>
<DIV><FONT face=3DArial size=3D2><CFIF #Form.Subscribe# IS=20
"Remove"><BR><!-- Check database for email address submitted on =
form=20
---><BR> <CFQUERY NAME=3D"CheckEmail"=20
DATASOURCE=3D"GFMaillist1"><BR> =
SELECT *=20
FROM Subscribers<BR> WHERE Email =3D =
'#Form.Email#'<BR> </CFQUERY><BR><!--- If email =
exists,=20
delete from mailing list-----><BR> <CFIF #CheckEmail.Email# =
IS=20
"#Form.Email#"><BR> <CFQUERY NAME=3D"RemoveUser"=20
DATASOURCE=3D"GFMaillist1"><BR> DELETE FROM Subscribers =
WHERE Email=20
=3D '#Form.Email#' <BR> </CFQUERY><BR> <CFOUTPUT=20
QUERY=3D"CheckEmail"><BR> <B>Your email #Form.Email# has =
been=20
successfully removed from the mailing=20
list.</B><BR> </CFOUTPUT><BR><!--- Send removal =
notification=20
---> <BR><CFMAIL SERVER =3D"mail.paconline.net" PORT=3D"25" =
TO=3D"#Email#" <A=20
href=3D'mailto:FROM=3D"[EMAIL PROTECTED]'>FROM=3D"Brianlee@GoldenFly=
.com</A>"=20
SUBJECT=3D"Goldenfly mailing list removal confirmation"><BR>Removal=20
message...</CFMAIL> <BR><CFELSE></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><!--- if email doesn't exist, =
display message=20
---><BR> <CFOUTPUT><BR> <B>Your email=20
<B>#Form.Email#</B> does not exist in the=20
database.</B><BR> </CFOUTPUT><BR></CFIF></CFIF&=
gt;<BR></DIV></FONT>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>Any help would be =
appreciated.</FONT></DIV>
<DIV>thanks,</DIV>
<DIV><FONT face=3DArial size=3D2>Kristin</FONT></DIV></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><A=20
href=3D"mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</A></FONT><=
/DIV>
<DIV> </DIV></BODY></HTML>
------=_NextPart_000_035F_01BFC677.D3146400--
------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.