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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Have I got too many if's

Status
Not open for further replies.

Papa Bear

Programmer
Feb 1, 2003
37
0
0
GB
Hi All

One of my pages stopped working today with the error

Active Server Pages error 'ASP 0127'
Missing close of HTML comment
/Lawn/lawnprog/Print_invoices.asp, line 497
The HTML comment or server-side include lacks the close tag (-->).

I removed code until the page worked and then added code back until it failed. The code that worked is
Code:
<%
if designRS("Pay_Method") = "Yes" then %>
    <tr><td style="border:0"><%=designRS("Pay_Method_Text")%></td></tr>
    <%
    if designRS("Pay_Cash") = "Yes" then %>
       <tr><td style="border:0">&bull;&nbsp;&nbsp;Cash</td></tr>
    <%end if
    
    if designRS("Pay_Bacs") = "Yes" then %>
        <tr><td style="border:0">&bull;&nbsp;&nbsp;Bacs: <%=CompanyRS("Bacs_No") %></td></tr>
    <%end if
    
    if designRS("Pay_Online") = "Yes" then %>
        <tr><td style="border:0">&bull;&nbsp;&nbsp;Online Payment: <%=CompanyRS("Bacs_No") %></td></tr>
        <tr><td style="border:0">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(Please use your customer number '<%=BookingRS("CustID")%>' as your reference)</td></tr>
    <%end if
end if %>
I then added another IF like this
Code:
<%
if designRS("Pay_Method") = "Yes" then %>
    <tr><td style="border:0"><%=designRS("Pay_Method_Text")%></td></tr>
    <%
    if designRS("Pay_Cash") = "Yes" then %>
       <tr><td style="border:0">&bull;&nbsp;&nbsp;Cash</td></tr>
    <%end if
    
    if designRS("Pay_Bacs") = "Yes" then %>
        <tr><td style="border:0">&bull;&nbsp;&nbsp;Bacs: <%=CompanyRS("Bacs_No") %></td></tr>
    <%end if
    
    if designRS("Pay_Online") = "Yes" then %>
        <tr><td style="border:0">&bull;&nbsp;&nbsp;Online Payment: <%=CompanyRS("Bacs_No") %></td></tr>
        <tr><td style="border:0">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(Please use your customer number '<%=BookingRS("CustID")%>' as your reference)</td></tr>
    <%end if

    if designRS("Pay_Cheque") = "Yes" then %>
       <tr><td style="border:0">jjkjdsfkjsdkjflskdlj</td></tr>
       <tr><td style="border:0">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td></tr>
    <%end if  


end if %>
And it fails with the above error message! I have not changed this code for several months and the error does not seem to relate to the new code.

Any ideas please
 
Rather than all those if then .. end if use a

select case .... case ... end case structure

Or

if then ... elseif then ... end if structure

( )


Note the lack of space between else & if in elseif as it is a continuation of the if .. then rather than a separate if ... then construct.

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
Does any of your data (Pay_Method_Text, Bacs_no, CustID) happen to be --
 
it looks like your problem outside of your published code...
look on commented html...
 
Instead of writing the field values directly likle this:
Code:
<%=CompanyRS(...

Use HTMLEncode:
Code:
<%=Server.HTMLEncode(CompanyRS(...

This way you should be safe from accidental HTML misinterpretation.

Cheers,
MakeItSo

ôKnowledge is power. Information is liberating. Education is the premise of progress, in every society, in every family.ö (Kofi Annan)
Oppose SOPA, PIPA, ACTA; measures to curb freedom of information under whatever name whatsoever.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top