C
Cassandra Flowers
Dear group,
I have never done any ASP coding before (Just HTML and Javascript as far as
web pages go - and got on fine)
I would like to start writing some ASP scripts, but I am having difficulties
viewing '*.asp' files on my PC, when I open them only the HTML aspects of
the code displays or I just get a blank browser window.. I am running XP, is
there something special that I need to install?
Please forgive me for asking what probably sounds like a stupid question,
but as you have probably gathered I haven't got a clue!!! )
Thanks,
Cassandra
I am trying to create a simple "Tell A Friend" page. The code I have is as
follows:
****************************************************************************
**********************************************
(File: Functions.asp)
<%
function mail(mMessage, mFrom, mTo, mSubject)
Dim objMail
Set objMail = Server.CreateObject("CDONTS.NewMail")
objMail.From = mFrom
objMail.Subject = mSubject
objMail.To = mTo
objMail.Body = mMessage
objMail.Send
set objMail = nothing
end function
function tellFriend(pageName)
if Request.QueryString("mailsent") = "true" Then
Response.Write "<P><strong>Your recommendation has been
sent.</strong></P>"
end if
Response.Write "<P>To tell a friend about this page, complete your
friend's name and
email address and write your name and email address below.<P>" &vbCrLf
Response.Write "form method = ""post"" action =
""tellafriend_script.asp""> &vbCrLf
Response.Write "<p>Your name:<br />" &vbCrLf
Response.Write "<input type=""text"" name=""senderName"" id=""senderName""
/></P>" &vbCrLf
Response.Write "<P>Your Email Address:<br />" &vbCrLf
Response.Write "<input type=""text"" name=""senderEmail""
id=""senderEmail"" /></P>" &vbCrLf
Response.Write "<p>Your friend's name:<br />" &vbCrLf
Response.Write "<input type=""text"" name=""friendName"" id=""friendName""
/></P>" &vbCrLf
Response.Write "<P>Your Friend's Email Address:<br />" &vbCrLf
Response.Write "<input type=""text"" name=""friendEmail""
id=""friendEmail"" /></P>" &vbCrLf
Response.Write "<input type =""hidden"" name=""pageName"" value=""" &
pageName & """ />" &vbCrLf
Response.Write "<input type =""submit"" value=""send!"" class=""submit"">
</P>" &vbCrLf
Response.Write "</form>" &vbCrLf
end function
%>
****************************************************************************
*********************************************
(File: tellafriend_script.asp)
<%@LANGUAGE = "vbscript"%>
<%Option Explicit%>
<!-#includefile=function.asp"->
<%
Dim senderName, senderEmail, friendName, friendEmail, pageName
Dim mailSubject, mailMessage, sendmail
senderName = Trim(Request.Form("senderName"))
senderEmail = Trim(Request.Form("senderEmail"))
friendName = Trim(Request.Form("friendName"))
friendEmail = Trim(Request.Form("friendEmail"))
pageName = Trim(Request.Form("pageName"))
mailSubject = senderName & " has recommended this web page to you"
mailMessage = "Dear " & friendName & "," &vbCrLf &vbCrLf
mailMessage = mailMessage & "your friend " & senderName & " has recommended
that you visit the following
page." &vbCrLf &vbCrLf
mailMessage = mailMessage & "http://www.yourdomain.com/" & pageName &vbCrLf
&vbCrLf
mailMessage = mailMessage & "We have not stored your details."
sendmail = mail(mailMessage, senderEmail, friendEmail, mailSubject)
Response.Redirect(pageName & "?mailsent=true")
%>
****************************************************************************
**********************************************
(File: Tellafriend.html)
<%@LANGUAGE = "vbscript"%>
<%Option Explicit%>
<!-#includefile=function.asp"->
<%Dim display%>
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Tell a friend</title>
</head>
<body>
<% display = tellFriend("tellafriend.asp")%>
</body>
</html>
I have never done any ASP coding before (Just HTML and Javascript as far as
web pages go - and got on fine)
I would like to start writing some ASP scripts, but I am having difficulties
viewing '*.asp' files on my PC, when I open them only the HTML aspects of
the code displays or I just get a blank browser window.. I am running XP, is
there something special that I need to install?
Please forgive me for asking what probably sounds like a stupid question,
but as you have probably gathered I haven't got a clue!!! )
Thanks,
Cassandra
I am trying to create a simple "Tell A Friend" page. The code I have is as
follows:
****************************************************************************
**********************************************
(File: Functions.asp)
<%
function mail(mMessage, mFrom, mTo, mSubject)
Dim objMail
Set objMail = Server.CreateObject("CDONTS.NewMail")
objMail.From = mFrom
objMail.Subject = mSubject
objMail.To = mTo
objMail.Body = mMessage
objMail.Send
set objMail = nothing
end function
function tellFriend(pageName)
if Request.QueryString("mailsent") = "true" Then
Response.Write "<P><strong>Your recommendation has been
sent.</strong></P>"
end if
Response.Write "<P>To tell a friend about this page, complete your
friend's name and
email address and write your name and email address below.<P>" &vbCrLf
Response.Write "form method = ""post"" action =
""tellafriend_script.asp""> &vbCrLf
Response.Write "<p>Your name:<br />" &vbCrLf
Response.Write "<input type=""text"" name=""senderName"" id=""senderName""
/></P>" &vbCrLf
Response.Write "<P>Your Email Address:<br />" &vbCrLf
Response.Write "<input type=""text"" name=""senderEmail""
id=""senderEmail"" /></P>" &vbCrLf
Response.Write "<p>Your friend's name:<br />" &vbCrLf
Response.Write "<input type=""text"" name=""friendName"" id=""friendName""
/></P>" &vbCrLf
Response.Write "<P>Your Friend's Email Address:<br />" &vbCrLf
Response.Write "<input type=""text"" name=""friendEmail""
id=""friendEmail"" /></P>" &vbCrLf
Response.Write "<input type =""hidden"" name=""pageName"" value=""" &
pageName & """ />" &vbCrLf
Response.Write "<input type =""submit"" value=""send!"" class=""submit"">
</P>" &vbCrLf
Response.Write "</form>" &vbCrLf
end function
%>
****************************************************************************
*********************************************
(File: tellafriend_script.asp)
<%@LANGUAGE = "vbscript"%>
<%Option Explicit%>
<!-#includefile=function.asp"->
<%
Dim senderName, senderEmail, friendName, friendEmail, pageName
Dim mailSubject, mailMessage, sendmail
senderName = Trim(Request.Form("senderName"))
senderEmail = Trim(Request.Form("senderEmail"))
friendName = Trim(Request.Form("friendName"))
friendEmail = Trim(Request.Form("friendEmail"))
pageName = Trim(Request.Form("pageName"))
mailSubject = senderName & " has recommended this web page to you"
mailMessage = "Dear " & friendName & "," &vbCrLf &vbCrLf
mailMessage = mailMessage & "your friend " & senderName & " has recommended
that you visit the following
page." &vbCrLf &vbCrLf
mailMessage = mailMessage & "http://www.yourdomain.com/" & pageName &vbCrLf
&vbCrLf
mailMessage = mailMessage & "We have not stored your details."
sendmail = mail(mailMessage, senderEmail, friendEmail, mailSubject)
Response.Redirect(pageName & "?mailsent=true")
%>
****************************************************************************
**********************************************
(File: Tellafriend.html)
<%@LANGUAGE = "vbscript"%>
<%Option Explicit%>
<!-#includefile=function.asp"->
<%Dim display%>
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Tell a friend</title>
</head>
<body>
<% display = tellFriend("tellafriend.asp")%>
</body>
</html>