Results 1 to 5 of 5

Thread: If statement not working WHY????????

Threaded View

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Apr 2001
    Location
    New York
    Posts
    679

    Resolved If statement not working WHY????????

    I have the following within a JSP, and all I am trying to do is compare the values that are returned by request.getParameter..

    Code:
    <%
    
    String name = request.getParameter("Name");
    String dept = request.getParameter("Department");
    String mgr = request.getParameter("Manager");
    String q1 = request.getParameter("q1");
    String q2 = request.getParameter("q2");
    String q3 = request.getParameter("q3");
    String a1 = request.getParameter("a1");
    String a2 = request.getParameter("a2");
    String a3 = request.getParameter("a3");
    
    
    	ddpe.sqltools.SQLTool q= new ddpe.sqltools.SQLTool("sun.jdbc.odbc.JdbcOdbcDriver","MysteryWeb",true);
    
    		
    	q.doSelectQuery("INSERT INTO Mystery VALUES('"+name+"', '"+dept+"', '"+mgr+"', '"+q1+"', '"+q2+"', '"+q3+"')");
    	
    	//out.println(q.getError());
    	//out.println(a1);
    	//out.println(q1);
    	q.close();	
    
    	
    %>
    <font size=3 color="990033"><b>1.  </b></font><font size=3 color="330099"><b>If a customer has a question on a Business Card, which of the following numbers do you use to warm transfer?:</b></font>
    <p>
    <%
    	
    	if (q1=="866-341-5203 - Correct")
    		out.println("<font size=3><b>Your answer to question # 1 was</font><font color='red'> INCORRECT!</font><p><font color='blue'></b><b>  The correct answer is - 866-341-5203 </b></font><p>");
    	else
    		out.println("<font size=3 color='blue'><b>You answered question # 1 CORRECT!</b></font>");
    %>
    
    <font size=3 color="990033"><b>2.  </b></font><font size=3 color="330099"><b>When Cold Transfer is in effect, does this mean that you can cold transfer to the Branches?:</b></font>
    <br>
    <%
    	if (q2!="Yes - Correct")
    		out.println("<font size=3><b>Your answer to question # 2 was</font><font color='red'> INCORRECT!</font><P><font color='blue'></b><b>  The correct answer is - Yes </b></font><p>");
    	else
    		out.println("<font size=3 color='blue'><b>You answered question # 2 CORRECT!</b></font>");
    
    %>
    
    <font size=3 color="990033"><b>3.  </b></font><font size=3 color="330099"><b>If a customer calls to do a wire transfer over the phone, you should :</b></font>
    <br>
    <%
    	if (q3!="Inform of Procedures - Correct")
    		out.println("<font size=3><b>Your answer to question # 3 was</font><font color='red'> INCORRECT!</font><P><font color='blue'></b><b>  The correct answer is - Explain the procedures on how to fax their request with their TAC</b></font><p>");
    	else
    		out.println("<font size=3 color='blue'><b>You answered question # 3 CORRECT!</b></font>");
    
    %>
    The if statments are not working properly...I do not know why...can someone please enlighten me??

    Thank you!
    Last edited by Dilenger4; Oct 7th, 2004 at 05:06 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width