Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to load a Scroll Menu from a Database?

Status
Not open for further replies.

Vem786

Technical User
Dec 2, 2003
52
US
Hi All:
I have a HTML page which has a Scroll Menu. I want the data to get loaded into that Scroll Menu from a Database dynamically(i.e when the page gets loaded).

Any ideas how to achieve this?

Thanks All!!!
 
Do you have access to server-side scripting (i.e. ASP, JSP, PHP, etc)?

If so, that would be your best bet.

Dan
 
Here's an outline using ASP, it won't be much different for other server side languages, barring syntax.
Code:
<select name=blahSelect>
<%
oRS.Source = &quot;SELECT BLAH FROM DATABASE WHERE SOMEVALUE = CONDITION&quot;;                }
oRS.Open();
if (oRS.RecordCount > 0) {
   oRS.MoveFirst;
   for (i = 0; i < oRS.RecordCount; i++) {
      Response.Write(&quot;<option value='&quot; + 
      oRS.Fields('BLAH').value + &quot;'>&quot; + 
      oRS.Fields('BLAH').value + &quot;</option>\n&quot;);
      oRS.MoveNext;
   }
}
%>
</select>

-kaht

banghead.gif
 
So Should the Select Statement be put in a JSP( I have Java Environment)? Also How do I call this JSP from the Scroll Menu in a HTML page?

Thanks!!!
 
You don't call the JSP from the scroll menu, you use the JSP to generate the scroll menu, much as I showed above with ASP, however I don't know exact JSP syntax, but it shouldn't be hard to convert.

-kaht

banghead.gif
 
Thank You!!!

Let me give it a shot, If I need more help I'll be back here again.

This site is loaded with Genius's!!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top