|
| |
|
|
Nalon
Posts: 2 Joined: 5/8/2009 Status: offline
|
drop down w/page redirect data results - 5/8/2009 11:55:03
Okay I have two issues .. 1). How do I code this page to have it load the database results on page load without gatting an input from someone? This page was a link from the default.htm page using a drop down menu. The default.htm page has an "include page" and my thinking is the error is from the jumpmenu within the drop down. This code below also has the same drop down and jump values. 2). I really want to use the drop down w/jumpmenu to keep things clean but I'm getting tangled. At one point I was able to get the Ohio page to function but then I tested more adding data to Alabama and neither page when loaded from default display data now. The script below is from ohio.asp <html> <head> <% ' FP_ASP -- ASP Automatically generated by a Frontpage Component. Do not Edit. FP_CharSet = "windows-1252" FP_CodePage = 1252 %> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <% ' FP_ASP -- ASP Automatically generated by a Frontpage Component. Do not Edit. FP_LCID = 1033 %> <meta http-equiv="Content-Language" content="en-us"> <meta name="GENERATOR" content="Microsoft FrontPage 5.0"> <meta name="ProgId" content="FrontPage.Editor.Document"> <title>Shadow inventory foreclosed real estate classified advertisement listings.</title> <script type="text/javascript"> <!-- function FP_jumpMenu(el,frm,sel) {//v1.0 var href=el.options[el.selectedIndex].value; if(sel) el.selectedIndex=0; if('_new'==frm) open(href); else eval(frm+".location='"+href+"'"); } // --> </script> </head> <body bgcolor="#000000" link="#FFFFCC" vlink="#FFFFCC" alink="#FFFFCC"> <table border="0" cellpadding="0" width="100%" height="24" cellspacing="0"> <tr> <td align="right" valign="top" width="50%" rowspan="3" height="16"> <table border="0" width="100%" height="20" cellspacing="0" cellpadding="0"> <tr> <td width="26%" align="center" valign="middle" height="1"> <table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td width="100%"> <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" id="AutoNumber1"> <tr> <td width="100%"> <table width="717" border="1"> <thead> </thead> <tbody> <tr><td align=left width="707"> <table width="707" border="1"> <thead> </thead> <tbody> <tr> <td width="697" align="center" bordercolor="#0033CC" bgcolor="#FFFFCC"> <table width="100%" border="1"> <thead> </thead> <tbody> <!--webbot bot="DatabaseRegionStart" s-columnnames="ID,first,last,number,street,city,state,zip,phone,image,comment,Remote_computer_name,User_name,Browser_type,Timestamp,staeid" s-columntypes="3,202,202,202,202,202,202,202,202,203,203,202,202,202,135,3" s-dataconnection="ads" b-tableformat="TRUE" b-menuformat="FALSE" s-menuchoice="first" s-menuvalue="first" b-tableborder="TRUE" b-tableexpand="TRUE" b-tableheader="TRUE" b-listlabels="TRUE" b-listseparator="TRUE" i-listformat="0" b-makeform="FALSE" s-recordsource="Results" s-displaycolumns="first,last,number,street,city,state,zip,phone,image,comment" s-criteria="[state] EQ {Ohio} + [city] GT {a} +" s-order="[ID] +" s-sql="SELECT * FROM Results WHERE (state = '::Ohio::' AND city > '::a::') ORDER BY ID ASC" b-procedure="FALSE" clientside suggestedext="asp" s-defaultfields="Ohio=&a=" s-norecordsfound="No records returned." i-maxrecords="256" i-groupsize="5" botid="0" u-dblib="../_fpclass/fpdblib.inc" u-dbrgn1="../_fpclass/fpdbrgn1.inc" u-dbrgn2="../_fpclass/fpdbrgn2.inc" tag="TBODY" preview="<tr><td colspan=64 bgcolor="#FFFF00" align="left" width="100%"><font color="#000000">This is the start of a Database Results region.</font></td></tr>" startspan b-WasTableFormat="TRUE" b-ReplaceDatabaseRegion="FALSE" --><!--#include file="../_fpclass/fpdblib.inc"--> <% if 0 then %> <SCRIPT Language="JavaScript"> document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>"); </SCRIPT> <% end if %> <% fp_sQry="SELECT * FROM Results WHERE (state = '::Ohio::' AND city > '::a::') ORDER BY ID ASC" fp_sDefault="Ohio=&a=" fp_sNoRecords="<tr><td colspan=10 align=left width=""100%"">No records returned.</td></tr>" fp_sDataConn="ads" fp_iMaxRecords=256 fp_iCommandType=1 fp_iPageSize=5 fp_fTableFormat=True fp_fMenuFormat=False fp_sMenuChoice="first" fp_sMenuValue="first" fp_iDisplayCols=10 fp_fCustomQuery=False BOTID=0 fp_iRegion=BOTID %> <!--#include file="../_fpclass/fpdbrgn1.inc"--> <!--webbot bot="DatabaseRegionStart" endspan i-checksum="44467" --><tr> <td> <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="752" id="AutoNumber1"> <tr> <td width="750" align="left" bgcolor="#FFFFFF" bordercolor="#0033CC" colspan="2"> <p align="center"> <a href="../upload.html"><img border="0" src="../images/create.png"></a></td> </tr> <tr> <td width="750" align="left" bgcolor="#FFFFCC" bordercolor="#0033CC" colspan="2"> <p align="center"> </td> </tr> <tr> <td width="156" align="left" bgcolor="#FFFFCC" bordercolor="#0033CC"> <p align="center"> <a href="<%=FP_FieldVal(fp_rs,"image")%>"> <img border="1" src="<%=FP_FieldVal(fp_rs,"image")%>" width="152" height="156" alt="Click on image for a closer look" align="absmiddle"></a></td> <td width="594" align="left" bgcolor="#FFFFCC" bordercolor="#0033CC"> <p align="center"> <b> <!--webbot bot="DatabaseResultColumn" s-columnnames="ID,first,last,number,street,city,state,zip,phone,image,comment,Remote_computer_name,User_name,Browser_type,Timestamp,staeid" s-column="first" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1"><<</font>first<font size="-1">>></font>" startspan --><%=FP_FieldVal(fp_rs,"first")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="9997" --> <!--webbot bot="DatabaseResultColumn" s-columnnames="ID,first,last,number,street,city,state,zip,phone,image,comment,Remote_computer_name,User_name,Browser_type,Timestamp,staeid" s-column="last" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1"><<</font>last<font size="-1">>></font>" startspan --><%=FP_FieldVal(fp_rs,"last")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="5856" --> Phone: <!--webbot bot="DatabaseResultColumn" s-columnnames="ID,first,last,number,street,city,state,zip,phone,image,comment,Remote_computer_name,User_name,Browser_type,Timestamp,staeid" s-column="phone" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1"><<</font>phone<font size="-1">>></font>" startspan --><%=FP_FieldVal(fp_rs,"phone")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="10436" --><br> Address: </b> <!--webbot bot="DatabaseResultColumn" s-columnnames="ID,first,last,number,street,city,state,zip,phone,image,comment,Remote_computer_name,User_name,Browser_type,Timestamp,staeid" s-column="number" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1"><<</font>number<font size="-1">>></font>" startspan --><%=FP_FieldVal(fp_rs,"number")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="18938" --> <!--webbot bot="DatabaseResultColumn" s-columnnames="ID,first,last,number,street,city,state,zip,phone,image,comment,Remote_computer_name,User_name,Browser_type,Timestamp,staeid" s-column="street" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1"><<</font>street<font size="-1">>></font>" startspan --><%=FP_FieldVal(fp_rs,"street")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="19157" --> <!--webbot bot="DatabaseResultColumn" s-columnnames="ID,first,last,number,street,city,state,zip,phone,image,comment,Remote_computer_name,User_name,Browser_type,Timestamp,staeid" s-column="city" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1"><<</font>city<font size="-1">>></font>" startspan --><%=FP_FieldVal(fp_rs,"city")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="6315" --> <!--webbot bot="DatabaseResultColumn" s-columnnames="ID,first,last,number,street,city,state,zip,phone,image,comment,Remote_computer_name,User_name,Browser_type,Timestamp,staeid" s-column="state" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1"><<</font>state<font size="-1">>></font>" startspan --><%=FP_FieldVal(fp_rs,"state")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="12162" --> <!--webbot bot="DatabaseResultColumn" s-columnnames="ID,first,last,number,street,city,state,zip,phone,image,comment,Remote_computer_name,User_name,Browser_type,Timestamp,staeid" s-column="zip" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1"><<</font>zip<font size="-1">>></font>" startspan --><%=FP_FieldVal(fp_rs,"zip")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="6021" --><br> <font size="2"><b>Share</b></font><b><font size="2"> Image:</font></b><font size="2"><b> </b></font><b> <a href="<%=FP_FieldVal(fp_rs,"image")%>"><font size="2"><%=FP_FieldVal(fp_rs,"image")%></font></a></b></p> <div align="center"> <center> <table border="0" cellpadding="6" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber2" height="62"> <tr> <td width="100%" height="50" valign="top"> <p align="center"> <i> <!--webbot bot="DatabaseResultColumn" s-columnnames="ID,first,last,number,street,city,state,zip,phone,image,comment,Remote_computer_name,User_name,Browser_type,Timestamp,staeid" s-column="comment" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="<font size="-1"><<</font>comment<font size="-1">>></font>" startspan --><%=FP_FieldVal(fp_rs,"comment")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="15662" --></i></td> </tr> </table> </center> </div> <p> </td> </tr> </table> </td> </tr> <!--webbot bot="DatabaseRegionEnd" b-tableformat="TRUE" b-menuformat="FALSE" u-dbrgn2="../_fpclass/fpdbrgn2.inc" i-groupsize="5" clientside tag="TBODY" preview="<tr><td colspan=64 bgcolor="#FFFF00" align="left" width="100%"><font color="#000000">This is the end of a Database Results region.</font></td></tr><TR><TD ALIGN=LEFT VALIGN=MIDDLE COLSPAN=64><NOBR><INPUT TYPE=Button VALUE=" |< "><INPUT TYPE=Button VALUE=" < "><INPUT TYPE=Button VALUE=" > "><INPUT TYPE=Button VALUE=" >| "> [1/5]</NOBR><BR></td></tr>" startspan --><!--#include file="../_fpclass/fpdbrgn2.inc"--> <!--webbot bot="DatabaseRegionEnd" endspan i-checksum="56926" --></tbody> </table> </td> </tr> </tbody> </table> </td></tr></tbody> </table> </td> </tr> </table> </td> </tr> </table> </td> </tr> </table> </td> <td valign="top" width="40%" height="1"> <p align="center"><strong><font size="6" color="#FFFFCC">Ohio<br> </font><font color="#FFFFCC"><a href="http://shadowinventory.com"> ShadowInventory.com</a></font><font size="1" color="#FFFFCC"><br> </font></strong></td></tr> <tr> <td width="100%"> <p align="center"><img border="0" src="../images/bulk.png"></td> </tr> <tr> <td width="100%"> <p align="center"> <b><font face="Lucida Sans Unicode" size="2" color="#FFFFFF"><br> Browse</font></b></p> <form method="post"> <p align="center"> <select name="Select1" onchange="FP_jumpMenu(this,'window',true)"> <option value="">Select</option> <option value="http://shadowinventory.com/states/alabama.asp">Alabama</option> <option value="http://shadowinventory.com/states/arkansas.asp">Arkansas <option value="http://shadowinventory.com/states/arizona.asp">Arizona <option value="http://shadowinventory.com/states/california.asp">California <option value="http://shadowinventory.com/states/colorado.asp">Colorado <option value="http://shadowinventory.com/states/connecticut.asp">Connecticut <option value="http://shadowinventory.com/states/delaware.asp">Delaware <option value="http://shadowinventory.com/states/florida.asp">Florida <option value="http://shadowinventory.com/states/georgia.asp">Georgia <option value="http://shadowinventory.com/states/illinois.asp">Illinois <option value="http://shadowinventory.com/states/indiana.asp">Indiana <option value="http://shadowinventory.com/states/iowa.asp">Iowa <option value="http://shadowinventory.com/states/kansas.asp">Kansas <option value="http://shadowinventory.com/states/kentucky.asp">Kentucky <option value="http://shadowinventory.com/states/louisiana.asp">Louisiana <option value="http://shadowinventory.com/states/maryland.asp">Maryland <option value="http://shadowinventory.com/states/massachusetts.asp">Massachusetts <option value="http://shadowinventory.com/states/michigan.asp">Michigan <option value="http://shadowinventory.com/states/mississippi.asp">Mississippi <option value="http://shadowinventory.com/states/missouri.asp">Missouri <option value="http://shadowinventory.com/states/nevada.asp">Nevada <option value="http://shadowinventory.com/states/newhampshire.asp">New Hampshire <option value="http://shadowinventory.com/states/newyork.asp">New York <option value="http://shadowinventory.com/states/northcarolina.asp">North Carolina <option value="http://shadowinventory.com/states/northdakota.asp">North Dakota <option value="http://shadowinventory.com/states/ohio.asp">Ohio <option value="http://shadowinventory.com/states/oregon.asp">Oregon <option value="http://shadowinventory.com/states/pennsylvania.asp">Pennsylvania <option value="http://shadowinventory.com/states/southcarolina.asp">South Carolina <option value="http://shadowinventory.com/states/southdakota.asp">South Dakota <option value="http://shadowinventory.com/states/tennessee.asp">Tennessee <option value="http://shadowinventory.com/states/texas.asp">Texas <option value="http://shadowinventory.com/states/utah.asp">Utah <option value="http://shadowinventory.com/states/vermont.asp">Vermont <option value="http://shadowinventory.com/states/washington.asp">Washington <option value="http://shadowinventory.com/states/wisconsin.asp">Wisconsin <option value="http://shadowinventory.com/states/wyoming.asp">Wyoming </option> </select> </p> </form> <p align="center"> </td> </tr> </table> <table width="912"> <td width="906"> <p align="center"> <font color="#FFFFCC" face="Verdana,Geneva,Arial,Helvetica" size="1">© Copyright 2009 ShadowInventory.com All rights reserved.</font></table> </body>
|
|
|
|
TexasWebDevelopers
Posts: 722 Joined: 2/22/2002 From: Dallas, TX Status: offline
|
RE: drop down w/page redirect data results - 5/8/2009 14:41:03
Why in the world are you building a page for each state? OK--without trying to re-code this in FrontPage (I'll let you do that) here is the technique-- I'll stick with states only so you can see the logic. First, you use a form or hyperlink or dd menu to send the state variable to the database results page. You can use the dd menu or hyperlinks to pass the variable as a query string like this: <a href="http://shadowinventory.com/database_results.asp?state=Mississippi">Mississippi</a> The variable after the ? is "state" and the value is the state name. Then, at the top of the database_results.asp page (what we've named this sample page) you grab the variable from the querystring: <% xstate=request.querystring("state")%> To make sure that there is data in the sql statement when you open the page (like you requested) you can default to a state name like this: <% if xstate ="" then xstate="Alabama" else xstate=request.querystring("state") end if %> Now you have a variable named xstate that you can stick into the sql statement. The value of the variable (the state name) will change depending on the hyperlink clicked by the user AND the value of the variable will also change in your sql statement giving you new results ON THE SAME PAGE - no need to build 50 pages! Now open your database: <% Dim rsPerson,Conn,strConn,sql, rsResults set Conn = server.createobject("adodb.connection") strConn = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("fpdb/yourdatabase.mdb") Conn.open strConn,"","" %> Then create a recordset using a query with your variable stuck into the sql statement. SQL = "SELECT * FROM Results WHERE state = '" & xstate & "' ORDER BY ID ASC" Set rsResults = Server.CreateObject("ADODB.Recordset") rsResults.Open SQL, DBconn, 3, 3 Do while not rsResults.EOF %> Then write out your data as you loop through the results: <%=rsResults("first")%> <%=rsResults("last")%><br /> <%=rsResults("phone")%><br /> <%=rsResults("number")%> <%=rsResults("street")%><br /> <%=rsResults("city")%>, <%=rsResults("state")%> <%=rsResults("zip")%><br /> <% rsResults.MoveNext loop %> Then close the connections : <% Conn.Close Conn = Nothing rsResults.Close set rsResults = Nothing %> Now, upload this code as an asp page (let's call it database_results.asp since that's the same as the example hyperlink) , change the path and name to the correct database (bold) and it should run and display the Alabama data when you browse to it. To put another state into the database query simply upload your hyperlinks or dd menu on another page and reference the results page like this: <a href="http://shadowinventory.com/database_results.asp?state=Mississippi">Mississippi</a> ---example code---------------- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <% Dim rsPerson,Conn,strConn,sql set Conn = server.createobject("adodb.connection") strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("fpdb/yourdatabase.mdb") Conn.open strConn,"","" xstate=request.querystring("state") if xstate ="" then xstate="Alabama" else xstate=request.querystring("state") end if %> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Database results</title> <style type="text/css"> <!-- body { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 90%; color: #000000; line-height:1.4em; background-color: #FFFFFF; margin:auto; padding: 0px 0px 0px 0px; } --> </style> </head> <body> <% SQL = "SELECT * FROM Results WHERE state = '" & xstate & "' ORDER BY ID ASC" Set rsResults = Server.CreateObject("ADODB.Recordset") rsResults.Open SQL, DBconn, 3, 3 Do while not rsResults.EOF %> <%=rsResults("first")%> <%=rsResults("last")%><br /> <%=rsResults("phone")%><br /> <%=rsResults("number")%> <%=rsResults("street")%><br /> <%=rsResults("city")%>, <%=rsResults("state")%> <%=rsResults("zip")%><br /> <% rsResults.MoveNext loop %> <% Conn.Close Conn = Nothing rsResults.Close set rsResults = Nothing %> </body> </html> -------------end example------------------- Here is an example using dependent dropdown boxes to drill to content--- not exactly what you are doing but still interesting: http://www.texaswebdevelopers.com/examples/our_supplier_in.asp
< Message edited by TexasWebDevelopers -- 5/8/2009 14:57:36 >
_____________________________
Follow us on TWITTER
|
|
|
|
Nalon
Posts: 2 Joined: 5/8/2009 Status: offline
|
RE: drop down w/page redirect data results - 5/8/2009 17:00:02
Thanks for your reply, I can see you really know your stuff but I really wish you would have just answered my question instead of providing me with the info you did, all be it, it's all great information, I just really want to have the 50 pages. Okay so for the dd menu I have this now ... <form method="post"> <p align="center"> <select name="Select1" onchange="FP_jumpMenu(this,'window',true)"> <option value="">Select</option> <option value="http://shadowinventory.com/database_results.asp?state=Alabama">Alabama</option> <option value="http://shadowinventory.com/database_results.asp?state=Mississippi">Mississippi <option value="http://shadowinventory.com/database_results.asp?state=Ohio">Ohio </option> </select> </p> </form> So now can I just add this code here that you provided ... <% xstate=request.querystring("state")%> To make sure that there is data in the sql statement when you open the page (like you requested) you can default to a state name like this: <% if xstate ="" then xstate="Alabama" else xstate=request.querystring("state") end if %> between the <head> </head> tags on each page or do I have to do something else. I currently am able to use the following code but I really dont want to have 50 buttons ... <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <meta http-equiv="Content-Language" content="en-us"> <meta name="GENERATOR" content="Microsoft FrontPage 5.0"> <meta name="ProgId" content="FrontPage.Editor.Document"> <title>Shadow inventory foreclosed real estate classified advertisement listings.</title> <script type="text/javascript"> <!-- function FP_jumpMenu(el,frm,sel) {//v1.0 var href=el.options[el.selectedIndex].value; if(sel) el.selectedIndex=0; if('_new'==frm) open(href); else eval(frm+".location='"+href+"'"); } // --> </script> </head> <body bgcolor="#000000" link="#FFFFCC" vlink="#FFFFCC" alink="#FFFFCC"> <table border="0" cellpadding="0" width="100%" height="24" cellspacing="0"> <tr> <td align="right" valign="top" width="50%" height="16"> <table border="0" width="100%" height="20" cellspacing="0" cellpadding="0"> <tr> <td width="26%" align="center" valign="middle" height="1"> <table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td width="100%"> <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="288" id="AutoNumber1" align="left"> <tr> <td width="462" bordercolor="#0033CC" bgcolor="#FFFFCC"> <form BOTID="0" METHOD="POST" ACTION="alabama.asp"> <table BORDER="0" align="left"> <tr> <td><input NAME="Alabama" VALUE="Alabama" size="9"> </td> </tr> </table> <p align="left"><input TYPE="submit" value="Alabama"><!--webbot bot="SaveAsASP" clientside suggestedext="asp" preview=" " startspan --><!--webbot bot="SaveAsASP" endspan --></p> </form> <form BOTID="0" METHOD="POST" ACTION="ohio.asp"> <table BORDER="0" align="left"> <tr> <td><input NAME="Ohio" VALUE="Ohio" size="5"></td> </tr> </table> <p align="left"><input TYPE="submit" value="Ohio"><!--webbot bot="SaveAsASP" clientside suggestedext="asp" preview=" " startspan --><!--webbot bot="SaveAsASP" endspan --></p> </form> </table> </td> </tr> </table> </td> </tr> </table> </td> </tr> </table> </td> </tr> </table> <p> </p> </body>
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|