Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

response.write error 2

Status
Not open for further replies.

Reynet01

Technical User
Apr 27, 2004
59
US
this is probably so easy it's silly for me to ask but I keep getting errors with the below code what am I doing wrong


<% options= <%if request.form("radiogroup3")="0" then response.write "Basic" Else
if request.form("radiogroup3")="1" then response.write "with print module" Else
if request.form("radiogroup3")="2" then response.write "with e-mail module" else
if request.form("radiogroup3")="3" then response.write "with fax module" else
if request.form("radiogroup3")="4" then response.write "with print and email modules" else
if request.form("radiogroup3")="5" then response.write "with print and fax modules" else
if request.form("radiogroup3")="6" then response.write "with email and fax modules" else
if request.form("radiogroup3")="7" then response.write "with all modules" end if%>
%>

If knowledge were power I would be a AAA battery!
 
what is the error you are getting...i would suggest using the below way...a function with the case statements

<%
function setOptionsValue()
Case radiogroup3
'blah blah blah
END
return value
End function
%>

check the syntax though...

-DNG
 
get rid of your inner <% and %>

also, consider using a select case statement instead of all these ifs.

Code:
<%
Dim strOutput

Select Case Request.Form("radiogroup3")
  Case "0"
    strOutput = "Basic"
  Case "1"
    strOutput = "with print module"
  Case "2"
    strOutput = "with e-mail module"
  Case "3"
    strOutput = "with fax module"
  Case "4"
    strOutput = "with print and email modules"
  Case "5"
    strOutput = "with print and fax modules"
  Case "6"
    strOutput = "with email and fax modules"
  Case "7"
    strOutput = "with all modules"
  Case Else
    strOutput = "no value selected"
End Select

Response.Write strOutput
%>

*cLFlaVA
----------------------------
[tt]I already made like infinity of those at scout camp...[/tt]
beware of active imagination: [URL unfurl="true"]http://www.coryarthus.com/[/url]

BillyRayPreachersSonIsTheLeetestHax0rDude
[banghead]
 
oops...some typos...please check before using it....but you shud get the idea though
<%
function setOptionsValue()
Dim value
SELECT Case radiogroup3
Case 0
value="Basic"
...
...
END Select
return value
End function
%>

-DNG
 
in DNG's case, "return value" would actually be "setOptionsValue = value".

*cLFlaVA
----------------------------
[tt]I already made like infinity of those at scout camp...[/tt]
beware of active imagination: [URL unfurl="true"]http://www.coryarthus.com/[/url]

BillyRayPreachersSonIsTheLeetestHax0rDude
[banghead]
 
Ok I used this and I get no errors but when I am sending the email out I don't get the value


<%
function setOptionsValue()
Dim options
SELECT Case request.form("radiogroup3")
Case 0:
value= "Basic"
case 1:
value="with email module"
case 2:
value= "with fax module"
case 3:
value="with print and email module"
case 4:
value="with print and email module"
case 5:
value="with print and fax module"
case 6:
value="all modules"
END Select
return value
End function
%>


<%
email=session("x_email")
site= sitecode
Machine= machineid
currentime=date()
Set MyCDONTSMail = CreateObject("CDONTS.NewMail")
MyCDONTSMail.From= "Dealer License Management System <service@theggg.com>"
MyCDONTSMail.To= email
MyCDONTSMail.Subject="License registration receipt for: " + request.form("CustomerNametext")
MyBody="Below are the details of your purchase." & vbCrLf
MyBody="This is only a receipt of your transaction. You will be invoiced for purchase later." & vbCrLf & vbCrLf
MyBody =Mybody & "Product Registered: " + nm(1) + value & vbCrLf
MyBody =Mybody & "Customer: " + request.form("CustomerNametext") & vbCrLf
MyBody =Mybody & "Date of Registration: "& Date() & vbCrLf
MyBody =MyBody & "Registering Technician: "+ session("x_firstname") +" "+ session("x_lastname") & vbCrLf
MyBody = MyBody & "Technicians Company: " + session("x_company") & vbCrLf
MyBody = MyBody & "Date code was generated: " & Date() & vbCrLf
MyBody = MyBody & "Sitecode of Machine: " + request.form("frmsitecode") & vbCrLf
MyBody = MyBody & "Activation Code for Product: "+ activationcode & vbCrLf
MyBody = MyBody & "E-mail Support: service@theprogrammers.com" & vbCrLf
MyBody = MyBody & "Phone: " & vbCrLf & vbCrLf & vbCrLf
MyBody = MyBody & "Once again thank you for your purchase" & vbCrLf & vbCrLf
MyBody = MyBody & "The Team at the company"
MyCDONTSMail.Body= MyBody
MyCDONTSMail.Send
set MyCDONTSMail=nothing
%>


If knowledge were power I would be a AAA battery!
 
replace the line

return value

with

setOptionsValue = value

as cLFlaVA already suggested...

-DNG
 
plus, your previous mapping of values to text doesn't match your new mapping. 7 was "all", 6 was "with email and fax modules".

*cLFlaVA
----------------------------
[tt]I already made like infinity of those at scout camp...[/tt]
beware of active imagination: [URL unfurl="true"]http://www.coryarthus.com/[/url]

BillyRayPreachersSonIsTheLeetestHax0rDude
[banghead]
 
Ok here is what I have with no errors I am trying to put the "VALUE" in this line of the email but it never shows my value

MyBody =Mybody & "Product Registered: " + nm(1) & value & vbCrLf

I tried call setOptionsValue() instead of value


<%
function setOptionsValue()
Dim value
SELECT Case request.form("radiogroup3")
Case 0:
value= "Basic"
case 1:
value="with email module"
case 2:
value= "with fax module"
case 3:
value="with print and email module"
case 4:
value="with print and email module"
case 5:
value="with print and fax module"
case 6:
value="all modules"
END Select
setOptionsValue = value
End function
%>
<%
email=session("x_email")
site= sitecode
Machine= machineid
currentime=date()
Set MyCDONTSMail = CreateObject("CDONTS.NewMail")
MyCDONTSMail.From= "License Management System <service@.com>"
MyCDONTSMail.To= email
MyCDONTSMail.Subject="License registration receipt for: " + request.form("CustomerNametext")
MyBody="Below are the details of your purchase." & vbCrLf
MyBody="This is only a receipt of your transaction. You will be invoiced for purchase later." & vbCrLf & vbCrLf
MyBody =Mybody & "Product Registered: " + nm(1) & value & vbCrLf
MyBody =Mybody & "Customer: " + request.form("CustomerNametext") & vbCrLf
MyBody =Mybody & "Date of Registration: "& Date() & vbCrLf
MyBody =MyBody & "Registering Technician: "+ session("x_firstname") +" "+ session("x_lastname") & vbCrLf
MyBody = MyBody & "Technicians Company: " + session("x_company") & vbCrLf
MyBody = MyBody & "Date code was generated: " & Date() & vbCrLf
MyBody = MyBody & "Sitecode of Machine: " + request.form("frmsitecode") & vbCrLf
MyBody = MyBody & "Activation Code for Product: "+ activationcode & vbCrLf
MyBody = MyBody & "E-mail Support: serv@.com" & vbCrLf
MyBody = MyBody & "Phone:703- ext 120 " & vbCrLf & vbCrLf & vbCrLf
MyBody = MyBody & "Once again thank you for your purchase" & vbCrLf & vbCrLf
MyBody = MyBody & "The team"
MyCDONTSMail.Body= MyBody
MyCDONTSMail.Send
set MyCDONTSMail=nothing
%>

If knowledge were power I would be a AAA battery!
 
how about this:

Dim funcvalue
funcvalue=setOptionsValue()

and they try:

MyBody =Mybody & "Product Registered: " + nm(1) & funcvalue& vbCrLf

-DNG


 
Thanks Everyone that did the trick

DotnetGnat the last bit of code is now putting the value in the email

and I will also remove the plus signs and replace with ampersands like I am supposed to.

If knowledge were power I would be a AAA battery!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top