How can I make a link value based on the selection in a menu? What I am trying to do is:
1) determine if a record in a database has multiple records
2) If it does display a menu
3) have a url based on the selection in the menu
1 and 2 are done. How do I do number 3?
Here is my code
<body bgcolor="#ffffff" text="#000000" leftmargin="0" marginwidth="0" marginheight="0" topmargin="0">
<table width="500" height="350" background="images/showitem.gif">
<tr>
<td height="22"> </td>
<td height="22">
<%
'on error resume next
dim intProductID
intProductID = clng(0 + Request("PID")
if (intProductID > 0) then
dim adoDBConnect
Set adoDBConnect = Server.CreateObject("ADODB.Connection"
adoDBConnect.Open "DRIVER=Microsoft Access Driver (*.mdb);FIL=MS Access;DBQ=" & Server.MapPath("/database/20010208.mdb", "admin", ""
dim recProduct
set recProduct = Server.CreateObject("ADODB.RecordSet"
recProduct.CacheSize = 10
recProduct.CursorLocation = 3
recProduct.Open "SELECT * FROM queryPRODUCTLIST WHERE (queryPRODUCTLIST.ID=" & intProductID & "", adoDBConnect
if ((err.number = 0) and (not (recProduct.BOF and recProduct.EOF))) then
dim intTempUID
dim strTempNAME
intTempUID = recProduct("ID"
strTempNAME = replace(recProduct("NAME", "'", "\'"
%>
<script>
<!--
var PidValue
function updatePID(select) {
PidValue = select.selectedIndex;
return;
}
//Not sure if needed -->
</script>
</td>
<td nowrap valign="top" height="22"> </td>
<td valign="top" height="22" width="100%"><font face="times new roman, times" size="4" color="#ffffff" style="text-decoration: none;"><b>
<% = strTempNAME %>
</b></font></td>
<td height="22"> </td>
</tr>
<tr>
<td height="27" valign="bottom"> </td>
<td height="27" colspan="4" valign="bottom">
<div align="right"><font face="arial" size="2" color="#CC3300"> <b>
<% = recProduct("STYLES" %>
</b></font></div>
</td>
</tr>
<tr>
<td height="21"> </td>
<td height="21"> </td>
<td nowrap valign="top" height="21" colspan="3"> </td>
</tr>
<tr>
<td height="250"> </td>
<td height="250">
<p>
<% if (recProduct("PICTUREURL".ActualSize > 0) then %>
<img src="<% = recProduct("PICTUREURL" %>" width="200" height="250" hspace="0" border="0" alt="<% = strTempNAME %>"></p>
<p> </p>
</td>
<td nowrap valign="top"> </td>
<td valign="top" height="250" width="100%">
<% end if %>
<table align="center" border="0" cellpadding="2" cellspacing="0" width="100%" height="250">
<tr>
<td height="200" valign="top">
<form name="form1" method="post" action="/sendmsg.asp?command=<% = Server.URLEncode("/secure/editcart.asp?action=additem&pid=39"%>" target="_parent">
<font face="arial" size="2" color="#000000">
<% = recProduct("DESCRIPTION" %>
</font><br><br>
<font face="arial" size="2" color="#000000">
<%if (recProduct("Prodmultiple") then %>
<input type="submit" name="Submit" value="Submit">
<%Else%>
<a href="/sendmsg.asp?command=<% = Server.URLEncode("/secure/editcart.asp?action=additem&pid=" & intTempUID)%>" target="_parent">Buy
this item</a>
<%End IF%>
</font>
<%if (recProduct("Prodmultiple") then
dim NameTemp
dim recVersion
NameTemp = recProduct("Name"
set recVersion = Server.CreateObject("ADODB.Recordset"
recVersion.ActiveConnection = "DRIVER=Microsoft Access Driver (*.mdb);FIL=MS Access;DBQ=" & Server.MapPath("/database/20010208.mdb"&""
recVersion.Source = "SELECT * FROM queryPRODUCTLIST WHERE Name like '" + NameTemp + "'ORDER BY STYLES ASC "
recVersion.CursorType = 0
recVersion.CursorLocation = 2
recVersion.LockType = 3
recVersion.Open()
%>
<select name="select" onChange="updatePID(this)">
<%
While (NOT recVersion.EOF)
%>
<option value="<%=(recVersion.Fields.Item("ID".Value)%>" <%if (CStr(recVersion.Fields.Item("ID".Value) = CStr(recProduct.Fields.Item("ID".Value)) then Response.Write("SELECTED" : Response.Write(""%>><%=(recVersion.Fields.Item("STYLES".Value)%></option>
<%
recVersion.MoveNext()
Wend
If (recVersion.CursorType > 0) Then
recVersion.MoveFirst
Else
recVersion.Requery
End If
%>
</select>
<%End If%>
</form>
</td>
</tr>
<tr>
<td align="right" valign="top" height="20"><font face="arial" size="2" color="#000000"><b>-
<a href="javascript:window.close();" onMouseOver="window.status='Close'; return true;">Close</a>
-</b></font></td>
</tr>
</table>
</td>
<td>
<%
recProduct.Close
else
%>
<font color="#000000" face="verdana, arial" size="2" style="font-size: 11px;">The
requested product could not be found in the product catalog.</font>
<%
end if
adoDBConnect.Close
else
%>
<font color="#000000" face="verdana, arial" size="2" style="font-size: 11px;">The
requested product could not be found in the product catalog.</font>
<%
end if
%>
</td>
</tr>
</table>
</body>
1) determine if a record in a database has multiple records
2) If it does display a menu
3) have a url based on the selection in the menu
1 and 2 are done. How do I do number 3?
Here is my code
<body bgcolor="#ffffff" text="#000000" leftmargin="0" marginwidth="0" marginheight="0" topmargin="0">
<table width="500" height="350" background="images/showitem.gif">
<tr>
<td height="22"> </td>
<td height="22">
<%
'on error resume next
dim intProductID
intProductID = clng(0 + Request("PID")
if (intProductID > 0) then
dim adoDBConnect
Set adoDBConnect = Server.CreateObject("ADODB.Connection"
adoDBConnect.Open "DRIVER=Microsoft Access Driver (*.mdb);FIL=MS Access;DBQ=" & Server.MapPath("/database/20010208.mdb", "admin", ""
dim recProduct
set recProduct = Server.CreateObject("ADODB.RecordSet"
recProduct.CacheSize = 10
recProduct.CursorLocation = 3
recProduct.Open "SELECT * FROM queryPRODUCTLIST WHERE (queryPRODUCTLIST.ID=" & intProductID & "", adoDBConnect
if ((err.number = 0) and (not (recProduct.BOF and recProduct.EOF))) then
dim intTempUID
dim strTempNAME
intTempUID = recProduct("ID"
strTempNAME = replace(recProduct("NAME", "'", "\'"
%>
<script>
<!--
var PidValue
function updatePID(select) {
PidValue = select.selectedIndex;
return;
}
//Not sure if needed -->
</script>
</td>
<td nowrap valign="top" height="22"> </td>
<td valign="top" height="22" width="100%"><font face="times new roman, times" size="4" color="#ffffff" style="text-decoration: none;"><b>
<% = strTempNAME %>
</b></font></td>
<td height="22"> </td>
</tr>
<tr>
<td height="27" valign="bottom"> </td>
<td height="27" colspan="4" valign="bottom">
<div align="right"><font face="arial" size="2" color="#CC3300"> <b>
<% = recProduct("STYLES" %>
</b></font></div>
</td>
</tr>
<tr>
<td height="21"> </td>
<td height="21"> </td>
<td nowrap valign="top" height="21" colspan="3"> </td>
</tr>
<tr>
<td height="250"> </td>
<td height="250">
<p>
<% if (recProduct("PICTUREURL".ActualSize > 0) then %>
<img src="<% = recProduct("PICTUREURL" %>" width="200" height="250" hspace="0" border="0" alt="<% = strTempNAME %>"></p>
<p> </p>
</td>
<td nowrap valign="top"> </td>
<td valign="top" height="250" width="100%">
<% end if %>
<table align="center" border="0" cellpadding="2" cellspacing="0" width="100%" height="250">
<tr>
<td height="200" valign="top">
<form name="form1" method="post" action="/sendmsg.asp?command=<% = Server.URLEncode("/secure/editcart.asp?action=additem&pid=39"%>" target="_parent">
<font face="arial" size="2" color="#000000">
<% = recProduct("DESCRIPTION" %>
</font><br><br>
<font face="arial" size="2" color="#000000">
<%if (recProduct("Prodmultiple") then %>
<input type="submit" name="Submit" value="Submit">
<%Else%>
<a href="/sendmsg.asp?command=<% = Server.URLEncode("/secure/editcart.asp?action=additem&pid=" & intTempUID)%>" target="_parent">Buy
this item</a>
<%End IF%>
</font>
<%if (recProduct("Prodmultiple") then
dim NameTemp
dim recVersion
NameTemp = recProduct("Name"
set recVersion = Server.CreateObject("ADODB.Recordset"
recVersion.ActiveConnection = "DRIVER=Microsoft Access Driver (*.mdb);FIL=MS Access;DBQ=" & Server.MapPath("/database/20010208.mdb"&""
recVersion.Source = "SELECT * FROM queryPRODUCTLIST WHERE Name like '" + NameTemp + "'ORDER BY STYLES ASC "
recVersion.CursorType = 0
recVersion.CursorLocation = 2
recVersion.LockType = 3
recVersion.Open()
%>
<select name="select" onChange="updatePID(this)">
<%
While (NOT recVersion.EOF)
%>
<option value="<%=(recVersion.Fields.Item("ID".Value)%>" <%if (CStr(recVersion.Fields.Item("ID".Value) = CStr(recProduct.Fields.Item("ID".Value)) then Response.Write("SELECTED" : Response.Write(""%>><%=(recVersion.Fields.Item("STYLES".Value)%></option>
<%
recVersion.MoveNext()
Wend
If (recVersion.CursorType > 0) Then
recVersion.MoveFirst
Else
recVersion.Requery
End If
%>
</select>
<%End If%>
</form>
</td>
</tr>
<tr>
<td align="right" valign="top" height="20"><font face="arial" size="2" color="#000000"><b>-
<a href="javascript:window.close();" onMouseOver="window.status='Close'; return true;">Close</a>
-</b></font></td>
</tr>
</table>
</td>
<td>
<%
recProduct.Close
else
%>
<font color="#000000" face="verdana, arial" size="2" style="font-size: 11px;">The
requested product could not be found in the product catalog.</font>
<%
end if
adoDBConnect.Close
else
%>
<font color="#000000" face="verdana, arial" size="2" style="font-size: 11px;">The
requested product could not be found in the product catalog.</font>
<%
end if
%>
</td>
</tr>
</table>
</body>