View Full Version : how to include id# field of db in url?
gilgalbiblewhee
12-29-2005, 07:09 AM
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)
<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
Bullschmidt
01-03-2006, 01:15 AM
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)
Well I suppose one variable in a querystring can only do so much. If you want to specify a particular id (which you've already done) and a particular book and a particlular chapter then perhaps something like this could work:
showverse.asp?id=whatever&book=whatever&chapter=whatever
gilgalbiblewhee
01-03-2006, 05:15 AM
I did a Do Loop and it worked. I used x in between and when x < 1 it would write the first dropdown along with other things. And when x > 1 it would write the 2nd dropdown and end the page.
The problem now is an iFrame issue. The page kjvresp.asp has two iFrames. And within each iFrame there is another iFrame (I haven't used the first level of iFrames, only the second level.) The problem is that the fisrt dropdown is opening in the 1st iFrame but the 2nd dropdown opens in a new window instead of opening in the 2nd iFrame.
<table>
<td>
<form name="booksa" action="showversea.asp" method="get" target="ifrVerse">
<select name="id" size="10" style="width:200;" onchange="go1();">
<option value="4894">Deuteronomy 1:1</option>
<option value="1911">Exodus 14:21</option>
<option value="1916">Exodus 14:26</option>
<option value="1917">Exodus 14:27</option>
<option value="1922">Exodus 15:1</option>
<option value="1943">Exodus 15:22</option>
<option value="2026">Exodus 18:26</option>
<option value="3204">Leviticus 16:2</option>
<option value="3940">Numbers 7:89</option>
<option value="4145">Numbers 14:36</option>
<option value="10964">1 Chronicles 21:29</option>
<option value="18878">Isaiah 63:11</option>
<option value="23921">Matthew 23:2</option>
<option value="28570">1 Corinthians 10:2</option>
</select>
</td>
<tr>
<td align="center">
<input type="submit" value=" Search ">
<input type="Reset" value=" Clear the words ">
</td>
</tr>
</form>
</td>
<td>
<form name="booksb" action="showversea.asp" method="get" target="ifrVerse2">
<select name="id" size="10" style="width:200;" onchange="go1();">
<option value="4894">Deuteronomy 1:1</option>
<option value="1911">Exodus 14:21</option>
<option value="1916">Exodus 14:26</option>
<option value="1917">Exodus 14:27</option>
<option value="1922">Exodus 15:1</option>
<option value="1943">Exodus 15:22</option>
<option value="2026">Exodus 18:26</option>
<option value="3204">Leviticus 16:2</option>
<option value="3940">Numbers 7:89</option>
<option value="4145">Numbers 14:36</option>
<option value="10964">1 Chronicles 21:29</option>
<option value="18878">Isaiah 63:11</option>
<option value="23921">Matthew 23:2</option>
<option value="28570">1 Corinthians 10:2</option>
</select>
</td>
<tr>
<td align="center">
<input type="submit" value=" Search ">
<input type="Reset" value=" Clear the words ">
</td>
</tr>
</form>
</td>
</table>
<td>
<iframe
src ="/wheelofgod/kjvresplistboxa.asp"
width="300" height="1200" name="ifrverse" id="ifrVerse">
</iframe>
</td>
<td>
<iframe
src ="/wheelofgod/kjvresplistboxb.asp"
width="300" height="1200" name="ifrverse2" id="ifrVerse2">
</iframe>
</td>
gilgalbiblewhee
01-05-2006, 10:48 PM
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?
<% '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"-->
glenngv
01-06-2006, 02:08 AM
window.open("url", "nameOfTargetIFrame")
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.