There's a problem with dropdown's name="id" (referring to the id field taken from the value="<%=rs("id")%>").
WHen I change name="id" to name="book" and value="<%=rs("id")%>" to value="<%=rs("book")%>" I would get:
showverse.asp?book=(with the right number with the beginning of that book. But it needs to be more precise, down to the right id)
But if I leave it as "id" although the url will give:
showverse.asp?id=(with the right number but goes to the very first book and chapter)
Code:
<form name="books" action="showverse.asp" method="get" target="ifrVerse">
<select name="id" size="10" style="width:200;" onchange="go1();">
<%
Do until RS.eof
%>
<option selected value="<%=RS("id")%>"><%=RS("Book_Title")%> <%=RS("Chapter")%>:<%=RS("Verse")%></option>
<%
RS.movenext
if RS.eof then
exit do
end if
loop
%>
</select>
</td>
<tr>
<td align="center">
<input type="submit" value=" Search ">
<input type="Reset" value=" Clear the words ">
</td>
</tr>
</form>
attachment is the action="showverse.asp" in .txt
Compare bible texts (and other tools): TheWheelofGod
reorganized code - easier to read
How do you make the dropdown go to the javascript to write the address of the url to be opened and what's wrong (recycled code) with the javascript?
Code:
<% 'Option Explicit
Response.Buffer=false%>
<%
Const DB_NAME = "kjv.mdb" ' Name of our database file
Const INTRO = "introduction to the wheelofgod.asp"
Const THECYCLES = "cycles.asp"
Const SCRIPT_NAME = "kjv.asp" ' Name of this script
Const SCRIPT_NAMES = "kjvresp.asp"
const SCRIPT_SAVED = "redirect.asp"
Const SCRIPT_FEEDBACK = "mailto.asp"
Const SCRIPT_TEXT = "bibletext.asp"
Const RECORDS_PER_PAGE = 10 ' Number of records per page
Const adOpenForwardOnly = 0
Const adLockReadOnly = 1
Const adCmdTableDirect = &H0200
Const adUseClient = 3
Private Function GetConnectionString()
GetConnectionString = "Driver={Microsoft Access Driver (*.mdb)};" & _
"DBQ=" & Server.MapPath(DB_NAME) & ";" & _
"UID=;PWD=;"
End Function
Set Conn = server.createobject("ADODB.Connection")
Conn.open GetConnectionString
Dim x
x=0
do until x = 2
%>
<!--#include file=query.asp-->
<%
set RS = Server.CreateObject("ADODB.Recordset")
rs.PageSize= RECORDS_PER_PAGE
rs.CursorLocation = adUseClient
rs.CacheSize = 20
RS.Open SQL, Conn, adOpenForwardOnly, adLockReadOnly
rscount=rs.RecordCount
rspage=rs.PageCount
if request.querystring("page")="" then
page=1
else
page=cint((request.querystring("page")))
end if
if x < 1 then
response.write sql
%>
</br>
<!--#include file="kingjamespagetop.txt"-->
<script language="JavaScript" type="text/javascript">
<!--
function go1(){
location = "kjvresplistbox.asp?id=" + document.myForm.id.options[document.myForm.id.selectedIndex].value + "&Keyword=" + document.myForm.Keyword.value + "&Keywordb=" + document.myForm.Keywordb.value + "&Keywordc=" + document.myForm.Keywordc.value + "&Keywordd=" + document.myForm.Keywordd.value + "&Keyworde=" + document.myForm.Keyworde.value + "&Keywordf=" + document.myForm.Keywordf.value + "#bcv"
}
function go2(){
location = "kjvresplistbox.asp?Book=<%=Book%>&Chapter=" + document.myForm.Chapter.options[document.myForm.Chapter.selectedIndex].value + "&Keyword=" + document.myForm.Keyword.value + "&Keywordb=" + document.myForm.Keywordb.value + "&Keywordc=" + document.myForm.Keywordc.value + "&Keywordd=" + document.myForm.Keywordd.value + "&Keyworde=" + document.myForm.Keyworde.value + "&Keywordf=" + document.myForm.Keywordf.value + "#bcv"
}
//-->
</script>
<%
If Not rs.EOF Then
Response.Write "The King James Bible has <b>" & rs.RecordCount &_
"</b> verses matching "
If Trim(Keyword & "") <> "" Then
%>
<font color="red"><b><%=Keyword%></b></font><%
End If
If Trim(Keywordb & "") <> "" Then
%>
+ <font color="blue"><b><%=Keywordb%></b></font><%
End If
If Trim(Keywordc & "") <> "" Then
%>
+ <font color="green"><b><%=Keywordc%></b></font><%
End If
If Trim(Keywordd & "") <> "" Then
%>
+ <font color="orange"><b><%=Keywordd%></b></font><%
End If
If Trim(Keyworde & "") <> "" Then
%>
+ <font color="purple"><b><%=Keyworde%></b></font><%
End If
If Trim(Keywordf & "") <> "" Then
%>
+ <font color="aqua"><b><%=Keywordf%></b></font><%
End If
If Trim(Keywordg & "") <> "" Then
%>
+ <font color="aqua"><b><%=Keywordg%></b></font><%
End If
If Trim(Keywordh & "") <> "" Then
%>
+ <font color="aqua"><b><%=Keywordh%></b></font><%
End If
'spoke = Request.Querystring("spoke")
If Trim(spoke & "") <> "" Then
%>
in SPOKE <b><%=spoke%></b><%
End If
If Trim(number & "") <> "" Then
if request.QueryString("book_title")="yes" then
Response.Write " in <b>" & rs("book_title") & "</b>"
end if
if request.QueryString("book")="yes" then
Response.Write " in book <b>" & number & "</b>"
end if
if request.QueryString("chapter")="yes" then
Response.Write " in chapter <b>" & number & "</b>"
end if
if request.QueryString("verse")="yes" then
Response.Write " in verse <b>" & number & "</b>"
end if
End If
Response.Write ".</p>"
Response.Write "</br>There are " & rs.PageCount & " page(s) of result(s).</br>"
Response.Write "The current page is " & Page & ".<p>"
End if
end if
'<!--#include file=pagingrecordsets.asp-->
%>
<%If rs.BOF and rs.EOF Then%>
<H2 align="center">
We did not find a match of <i><b>
"<%=Keyword%>"
"<%=Keywordb%>"
"<%=Keywordc%>"
"<%=Keywordd%>"
"<%=Keyworde%>"
"<%=Keywordf%>"
"<%=Keywordg%>"
"<%=Keywordh%>"!</b></i></H2>
<h5 align=center><A HREF="<%=SCRIPT_FEEDBACK%>">Feedback Forum</A> |
<A HREF="<%=SCRIPT_NAME%>">Back To Search Page</A></h5>
<%Else
'<table border="1" cellspacing="1" bgcolor="#0066CC">
'<tr style="height:12.75pt">
'<!--#include file=sort.asp-->
'<!--#include file=tableofresults.asp-->
'</table>%>
<%end if%>
<table>
<table>
<%
Dim Book
Dim Chapter
Dim Verse
Dim DSNName
Dim Conn
Dim SQL1
Dim pagingurl
if x<1 then
%>
<tr>
<td>
<form name="booksa" action="showversea.asp" method="get" target="ifrVerse">
<select name="id" size="10" style="width:200;" onchange="go1();">
<%
Do until RS.eof
%>
<option <%if Request.QueryString("id")=RS("id") then response.write "selected" %> value="<%=RS("id")%>"><%=RS("Book_Title")%> <%=RS("Chapter")%>:<%=RS("Verse")%></option>
<%
RS.movenext
if RS.eof then
exit do
end if
loop
%>
</select>
</td>
</tr>
<tr>
<td>
<input type="submit" value=" Search ">
<%'<input type="Reset" value=" Clear the words ">%>
</td>
</tr>
</form>
</td>
<%
end if
x = x + 1
if x>1 then
%>
<tr>
<td>
<form name="booksb" action="showversea.asp" method="get" target="gaga">
<select name="id" size="10" style="width:200;" onchange="go1();">
<%
Do until RS.eof
%>
<option <%if Request.QueryString("id")=RS("id") then response.write "selected" %> value="<%=RS("id")%>"><%=RS("Book_Title")%> <%=RS("Chapter")%>:<%=RS("Verse")%></option>
<%
RS.movenext
if RS.eof then
exit do
end if
loop
%>
</select>
</td>
</tr>
<tr>
<td>
<input type="submit" value=" Search ">
<%'<input type="Reset" value=" Clear the words ">%>
</td>
</tr>
</form>
<%
end if
loop%>
</table>
<td>
<iframe
src ="/wheelofgod/kjvresplistbox.asp"
width="300" height="1200" name="ifrverse" id="ifrVerse">
</iframe>
</td>
<td>
<iframe
src ="/wheelofgod/kjvresplistbox.asp"
width="300" height="1200" name="gaga" id="gaga">
</iframe>
</td>
</table>
<%
'<!--#include file=pagingrecordsets.asp-->
rs.Close()%>
<!--#include file="kingjamespagebottom.txt"-->
Compare bible texts (and other tools): TheWheelofGod