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>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>In this case,&nbsp; 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.&nbsp;&nbsp;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.&nbsp;(It works if =
the=20
email is in</DIV>
<DIV>the database). &nbsp;Here's the entire code:</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&lt;CFPARAM NAME=3D"Form.Email"&gt; =
&lt;CFPARAM=20
NAME=3D"Form.Subscriber"&gt;<BR>&lt;CFPARAM NAME=3D"Form.Subscribe"&gt; =
&lt;!---=20
Subscribe values =3D "Add" or "Remove" ---&gt;<BR>&lt;!--- Subscribe =
user to the=20
mailing list ---&gt;<BR>&lt;CFIF "#Form.Subscribe#" IS =
"Add"&gt;<BR>&lt;!---=20
Query database for Email address submitted on form&nbsp;=20
---&gt;<BR>&nbsp;&lt;CFQUERY NAME=3D"CheckSubscribers"=20
DATASOURCE=3D"GFMaillist1"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
SELECT *=20
FROM Subscribers<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WHERE Email =3D =

'#Form.Email#'<BR>&nbsp;&nbsp; &nbsp;&lt;/CFQUERY&gt;<BR>&lt;!--- Check =
if Email=20
on the form already exists in database-----&gt;<BR>&lt;CFIF=20
#CheckSubscribers.Email# IS "#Form.Email#"&gt;<BR>&lt;!--- If email =
already=20
exists, display this message ---&gt;<BR>&lt;CFOUTPUT&gt;Your email =
#Form.Email#=20
already exists in the database.&lt;/CFOUTPUT&gt;<BR>&lt;!--- If email =
doesn't=20
exist, add to the database and send =
mail---&gt;<BR>&lt;CFELSE&gt;<BR>&lt;!---=20
Add user to the database---&gt;<BR>&nbsp;&lt;CFQUERY =
NAME=3D"AddNewSubscriber"=20
DATASOURCE=3D"GFMaillist1"&gt;<BR>&nbsp;&nbsp;INSERT INTO Subscribers =
(Subscriber,=20
EMail) <BR>&nbsp;&nbsp;VALUES ('#Form.Subscriber#',=20
'#Form.EMail#')<BR>&nbsp;&lt;/CFQUERY&gt;<BR>&nbsp;&lt;CFOUTPUT&gt;&lt;b&=
gt;Your=20
email #Form.Email# has been successfully added to the mailing=20
list!&lt;/B&gt;&lt;/CFOUTPUT&gt;<BR>&lt;!--- Send Email confirmation =
that they=20
have been added ---&gt;<BR>&nbsp;&lt;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!"&gt;<BR>&nbsp;Welcome=20
message..<BR>&nbsp;&lt;/CFMAIL&gt;<BR>&lt;/CFIF&gt;&lt;/CFIF&gt;</FONT></=
DIV>
<DIV>&lt;!--- Remove Subscriber from the mailing list ----&gt;</DIV>
<DIV><FONT face=3DArial size=3D2>&lt;CFIF #Form.Subscribe# IS=20
"Remove"&gt;<BR>&lt;!-- Check database for email address submitted on =
form=20
---&gt;<BR>&nbsp;&lt;CFQUERY NAME=3D"CheckEmail"=20
DATASOURCE=3D"GFMaillist1"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
SELECT *=20
FROM Subscribers<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WHERE Email =3D =

'#Form.Email#'<BR>&nbsp;&lt;/CFQUERY&gt;<BR>&lt;!---&nbsp; If email =
exists,=20
delete from mailing list-----&gt;<BR>&nbsp;&lt;CFIF #CheckEmail.Email# =
IS=20
"#Form.Email#"&gt;<BR>&nbsp;&lt;CFQUERY NAME=3D"RemoveUser"=20
DATASOURCE=3D"GFMaillist1"&gt;<BR>&nbsp;&nbsp;DELETE FROM Subscribers =
WHERE Email=20
=3D '#Form.Email#' <BR>&nbsp;&lt;/CFQUERY&gt;<BR>&nbsp;&lt;CFOUTPUT=20
QUERY=3D"CheckEmail"&gt;<BR>&nbsp;&lt;B&gt;Your email #Form.Email# has =
been=20
successfully removed from the mailing=20
list.&lt;/B&gt;<BR>&nbsp;&lt;/CFOUTPUT&gt;<BR>&lt;!--- Send removal =
notification=20
---&gt; <BR>&lt;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"&gt;<BR>Removal=20
message...&lt;/CFMAIL&gt; <BR>&lt;CFELSE&gt;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&lt;!--- if email doesn't exist, =
display message=20
---&gt;<BR>&nbsp;&lt;CFOUTPUT&gt;<BR>&nbsp;&lt;B&gt;Your email=20
&lt;B&gt;#Form.Email#&lt;/B&gt; does not exist in the=20
database.&lt;/B&gt;<BR>&nbsp;&lt;/CFOUTPUT&gt;<BR>&lt;/CFIF&gt;&lt;/CFIF&=
gt;<BR></DIV></FONT>
<DIV>&nbsp;</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>&nbsp;</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.

Reply via email to