View Single Post
  #8 (permalink)  
Old June 17th, 2005, 03:40 PM
phungleon phungleon is offline
Friend of Wrox
 
Join Date: Jul 2003
Location: , , .
Posts: 128
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Vijay,
I tried this method but got the same exact result as described above:
For i=lbound(ArrChecked) to ubound(ArrChecked)
    mySQL = mySQL & " AND " & CHARINDEX(ArrChecked(i), fields_of_interest) > 0
Next

Below are the codes to my whole page. Note the IP address is fictious.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
</head>
<%
'************************************************* **********
'* Step 1: Display the entry form
'************************************************* **********
If Len(Request.form("FormAction")) = 0 Then
%>

<body topmargin="0" bottommargin="0" rightmargin="0" leftmargin="0" marginwidth="0" marginheight="0">
<table align="center" width="780" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td
  </tr>
  <tr>
    <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td bgcolor="FF9F00"><img src="/images/spacer.gif" alt="" width="1" height="1"></td>
        </tr>
        <tr>
          <td></td>
        </tr>
        <tr>
          <td bgcolor="FF9F00"><img src="/images/spacer.gif" alt="" width="1" height="1"></td>
        </tr>
        <tr>
          <td bgcolor="003B6F"><img src="/images/spacer.gif" alt="" width="1" height="25"></td>
        </tr>
      </table><table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="206" valign="top">

<table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td colspan="2" bgcolor="929497"><img src="/images/spacer.gif" alt="" width="1" height="14"></td>
              </tr>
              <tr>
                <td valign="top"><img src="/images/left_top.gif" alt="left top scan lines" width="178" height="27"></td>
                <td rowspan="2" valign="top"><img src="/images/left_top_curve.gif" alt="curve" width="28" height="28"></td>
              </tr>
              <tr>
                <td valign="top"><img src="/images/left_bottom.gif" alt="Left bottom scan lines" width="178" height="45"></td>
              </tr>
            </table> <br></td>
          <td width="574" height="550" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr bgcolor="929497">
                <td colspan="2" valign="top"><img src="/images/spacer.gif" alt="" width="1" height="14"></td>
              </tr>
              <tr>
                <td valign="top"> <table width="100%" border="0" cellspacing="0" cellpadding="0"><tr>
                      <td class="breadcrumbs"><a name="main"></a>
                        <table width="100%" border="0" cellpadding="0" cellspacing="0">
                          <tr>
                            <td height="28"> <table width="41%" border="0" cellpadding="0" cellspacing="0" class="breadcrumbs">
                                <tbody>
                                  <tr>
                                    <td><a class="breadcrumbs" href="/default.asp">Home</a>&nbsp;&nbsp;</td>
                                    <td>&gt;</td>
                                    <td><a class="breadcrumbs" href="/hr.asp">&nbsp;&nbsp;HR&nbsp;&nbsp;</a></td>
                                    <td>&gt;</td>
                                    <td></td>
                                  </tr>
                                </tbody>
                              </table></td>
                            <td height="28" align="right"> <noscript>Javascript "print this page" feature</noscript> </td>
                          </tr>
                        </table></td>
                    </tr>
                    <tr>
                      <td class="header">You Can Make a Difference.. .</td>
                    </tr>
                    <tr>
                      <td><img src="/images/spacer.gif" alt="" width="1" height="10"></td>
                    </tr>
                    <tr>
                      <td class="headerorange">Internship Interest Form </td>
                    </tr>
                    <tr>
                      <td bgcolor="#999999"><p>.</p>
                        </td>
                    </tr>
                    <tr>
                      <td><img src="/images/spacer.gif" width="1" height="10"></td>
                    </tr>
                    <tr>
                      <td><form action="sample_Search.asp" method="POST" name="mainform" id="mainform">
                      <input type=hidden name="FormAction" value="Step2">
                        <table width="100%" border="0">
                        <tr>
                          <td colspan="6" bgcolor="#CCCCCC">&nbsp;</td>
                          </tr>
                        <tr bgcolor="#CCCCCC">
                          <td colspan="6"><span class="style12">Field of Interest </span></td>
                          </tr>
                        <tr>
                          <td colspan="6" valign="middle"><span class="style21"><span class="style33">6</span> Select a maximum of up to 4 academic majors and/or fields of interest:</span> <br>
                            <table width="100%" border="1">
                              <tr>
                                <td><span class="style22">
                                  <input name="fields_of_interest[]" type="checkbox" value="Accounting">
                                  </span></td>
                                <td>Accounting</td>
                                <td><span class="style22">
                                  <input name="fields_of_interest[]" type="checkbox" value="Geography">
                                </span></td>
                                <td>Geography </td>
                                <td><span class="style22">
                                  <input name="fields_of_interest[]" type="checkbox" value="Political Science">
                                </span></td>
                                <td>Political Science </td>
                              </tr>
                              <tr>
                                <td><input name="fields_of_interest[]" type="checkbox" value="Biological Science "></td>
                                <td> Biological Science </td>
                                <td><input name="fields_of_interest[]" type="checkbox" value="Gerontology"></td>
                                <td> Gerontology</td>
                                <td><input name="fields_of_interest[]" type="checkbox" value="Psychology"></td>
                                <td> Psychology</td>
                              </tr>
                              <tr>
                                <td><input name="fields_of_interest[]" type="checkbox" value="Business Administration"></td>
                                <td> Business Administration </td>
                                <td><input name="fields_of_interest[]" type="checkbox" value="Graphic Art/Design"></td>
                                <td> Graphic Art/Design </td>
                                <td><input name="fields_of_interest[]" type="checkbox" value="Public Administration"></td>
                                <td> Public Administration </td>
                              </tr>
                              <tr>
                                <td><input name="fields_of_interest[]" type="checkbox" value="Communications/Marketing"></td>
                                <td> Communications/Marketing</td>
                                <td><input name="fields_of_interest[]" type="checkbox" value="Health Science/Health Education"></td>
                                <td> Health Science/Health Education</td>
                                <td><input name="fields_of_interest[]" type="checkbox" value="Public Policy/Legislation"></td>
                                <td> Public Policy/Legislation</td>
                              </tr>
                              <tr>
                                <td><input name="fields_of_interest[]" type="checkbox" value="Computer/Information"></td>
                                <td> Computer/Information &amp; Technology</td>
                                <td><input name="fields_of_interest[]" type="checkbox" value="Horticulture/Landscape Architecture"></td>
                                <td> Horticulture/Landscape Architecture</td>
                                <td><input name="fields_of_interest[]" type="checkbox" value="Public Relations/Affairs"></td>
                                <td> Public Relations/Affairs</td>
                              </tr>
                              <tr>
                                <td><input name="fields_of_interest[]" type="checkbox" value="Earth Science"></td>
                                <td> Earth Science</td>
                                <td><input name="fields_of_interest[]" type="checkbox" value="Human Resources "></td>
                                <td> Human Resources</td>
                                <td><input name="fields_of_interest[]" type="checkbox" value="Research &amp; Analysis"></td>
                                <td> Research &amp; Analysis</td>
                              </tr>
                              <tr>
                                <td><input name="fields_of_interest[]" type="checkbox" value="Economics"></td>
                                <td> Economics</td>
                                <td><input name="fields_of_interest[]" type="checkbox" value="Law/Criminal Justice"></td>
                                <td> Law/Criminal Justice</td>
                                <td><input name="fields_of_interest[]" type="checkbox" value="Social Ecology"></td>
                                <td> Social Ecology</td>
                              </tr>
                              <tr>
                                <td><input name="fields_of_interest[]" type="checkbox" value="Education"></td>
                                <td> Education</td>
                                <td><input name="fields_of_interest[]" type="checkbox" value="Library Science"></td>
                                <td> Library Science</td>
                                <td><input name="fields_of_interest[]" type="checkbox" value="Social Work/Human Services"></td>
                                <td> Social Work/Human Services</td>
                              </tr>
                              <tr>
                                <td><input name="fields_of_interest[]" type="checkbox" value="Environmental Studies"></td>
                                <td> Environmental Studies</td>
                                <td><input name="fields_of_interest[]" type="checkbox" value="Natural Science"></td>
                                <td> Natural Science</td>
                                <td><input name="fields_of_interest[]" type="checkbox" value="Sociology/Social Science"></td>
                                <td> Sociology/Social Science</td>
                              </tr>
                              <tr>
                                <td><input name="fields_of_interest[]" type="checkbox" value="Finance"></td>
                                <td> Finance</td>
                                <td><input name="fields_of_interest[]" type="checkbox" value="Physical Science"></td>
                                <td> Physical Science</td>
                                <td><input name="fields_of_interest[]" type="checkbox" value="Other" onclick="togOpass();"></td>
                                <td><strong> Other</strong></td>
                              </tr>
                            </table></td>
                          </tr>
                        <tr>
                          <td colspan="6">&nbsp;</td>
                        </tr>
                        <tr>
                          <td colspan="3" align="right">&nbsp;</td>

                          <td colspan="3">&nbsp;</td>
                        </tr>
                        <tr>
                          <td colspan="3" align="right"><input name="SubmitForm" type="submit" id="SubmitForm" value="Submit"></td>
                          <td colspan="3"><input type="reset" name="Reset" value="Reset"></td>
                          </tr>
                        <tr>
                          <td width="10%">&nbsp;</td>
                          <td width="28%">&nbsp;</td>
                          <td width="11%">&nbsp;</td>
                          <td width="6%">&nbsp;</td>
                          <td width="9%">&nbsp;</td>
                          <td width="36%">&nbsp;</td>
                        </tr>
                      </table>
                          </form></td>
                    </tr>
                  </table></td>
                <td valign="top"><img src="/images/spacer.gif" alt="" width="6" height="1"></td>
              </tr>
            </table></td>
        </tr>
      </table></td>
  </tr>
  <tr>
    <td bgcolor="003B6F"> </td>
  </tr>
</table>
<%
ElseIf Request.form("FormAction") = "Step2" Then
Set conntemp = Server.CreateObject("ADODB.Connection")


conntemp.Open "Provider=SQLOLEDB.1; Data Source=127.127.127.10; Initial Catalog=internship_form; User Id=admin; Password=admin"

mySQL="SELECT ApplicantID, firstname, lastname, submitdate, email, fields_of_interest, bilingual_skills FROM internship_form where isArchive=0"

strList=Request.Form("fields_of_interest")
ArrChecked = split(strList)

For i=lbound(ArrChecked) to ubound(ArrChecked)
    mySQL = mySQL & "AND" & CHARINDEX(ArrChecked(i), fields_of_interest) > 0
    'If i < ubound(ArrChecked) then mySQL = mySQL & " AND "
Next
Response.write mySQL
Response.write strList
set rstemp=conntemp.execute(mySQL)
do while not rstemp.eof
%>


  <tr>
    <td><a href="<%=my_link%>"><%=rstemp("applicantID")%></a></td>
  </tr>


<%

rstemp.movenext
loop
rstemp.close
set rstemp=nothing
conntemp.close
set conntemp=nothing
End if
%>

</body>
</html>



Reply With Quote