The Forum has been Updated
The code has been upgraded to the latest .NET core version. Please check instructions in the Community Announcements about migrating your account.
I have decided to use this asp newsletter. I would like to change one thing in it.
There is a small form on the page that allows you to enter your email address to subscribe. The page then refreshes to give you more instructions.
What I would like it to do is when it refreshes is to have the form not appear any longer. How would I do this?
Here is the code for the page. The section in red is the part that I would like to not appear once an email is entered:
There is a small form on the page that allows you to enter your email address to subscribe. The page then refreshes to give you more instructions.
What I would like it to do is when it refreshes is to have the form not appear any longer. How would I do this?
Here is the code for the page. The section in red is the part that I would like to not appear once an email is entered:
Code:
<%@ Language = VBScript %>
<!-- #include file = "variables.asp" -->
<%
Email = request.form("Email")
'Send an email to the bugger to confirm the email address
if len(Email) <> 0 then
'Time to open the database
set con = server.createObject("ADODB.Connection")
con.open(strServerConnection)
'Check whether email exists
sqlString = "Select Email from Newsletter where Email = '"&Email&"'"
set rs = con.execute(sqlString)
'Return error if email already exists
while not rs.eof
if rs("Email") = Email then
output = "This email is already in our database."
blnError = true
end if
rs.moveNext
wend
if not blnError then
sqlString = "Insert into Newsletter (Email, Status) values ('"&Email&"', 0)"
con.execute(sqlString)
con.close
'Compose email message here
Message = "To confirm your subscription for our newsletter at "&CompanyName&" ("&DomainName&")," &vbCrLf
Message = Message & "simply click on the following link:" & vbCrLf & "http://"&DomainName&"/newsletter/newsletterConfirmation.asp?email="&Email
Message = Message & vbCrLf & vbCrLf & "If you did not sign up for this newsletter, please ignore this mail." &vbCrLf
Signature = vbCrLf & "Important: Do not reply to this email." & vbCrLf & vbCrLf & "____________________" & vbCrLf
Signature = Signature & CompanyName & vbCrLf & "http://"&DomainName
set newMailObj = server.createObject("CDONTS.NewMail")
newMailObj.BodyFormat = 1
newMailObj.MailFormat = 0
newMailObj.from = "no-reply@"&replace(DomainName, "www.", "")
newMailObj.to = Email
newMailObj.subject = CompanyName & " Newsletter Signup Confirmation."
newMailObj.body = Message & Signature
newMailObj.send
set newMailObj = nothing
output = "Signup successfully. <p>Please check your mailbox to confirm your subscription and activate your account."
end if
end if
%>
<html><!-- #BeginTemplate "/Templates/User_Newsletter.dwt" --><!-- DW6 -->
<head>
<!-- #BeginEditable "doctitle" -->
<title><%=CompanyName%> - Newsletter Subscription</title>
<!-- #EndEditable -->
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="styles.css" type="text/css">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<table width="60%" border="1" cellspacing="1" cellpadding="1" align="center" bordercolor="#000033">
<tr>
<td><!-- #BeginEditable "contents" -->
<p><b>Newsletter Subscription</b></p>
<p><%=output%></p>
<p>
<font color="red"><form name="newsletterForm" method="post" action="subscribeNewsletter.asp">
<b>Email: </b>
<input type="text" name="Email" size="30">
<input type="submit" name="Submit2" value="Signup">
</form></font id="red">
<!-- #EndEditable --></td>
</tr>
<tr>
<td>
<!-- Please do not remove this to support future releases of this script -->
<div align="center"><span class="tiny">myNewsletter version <%=ScriptVersion%><br>
<a href="http://www.aspburst.com" target="_blank">ASP Burst (http://www.aspburst.com)</a></span>
<!-- End footer -->
</div></td>
</tr>
</table>
</body>
<!-- #EndTemplate --></html>