Solved

Adding value to combobox

Posted on 2003-10-26
3
211 Views
Last Modified: 2010-04-01
Hi,

I have a combo box:

Color
<select name="col">
<option value='red'>Red</option>
<option value='blue'>Blue</option>
<option value='white'>White</option>
<option value='green'>Green</option>
<option value='black'>Black</option>
</select>


Values are set at the combo box using the option

How do i get it to get value from database,

for example i have a table
called Color with colorid and description.
How do i do it so that i could add new colors and it gets added to combo.And if i delete the value from database, it gets deleted from combo as well

Thanks
0
Comment
Question by:Jasbir21
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 14

Accepted Solution

by:
kennethxu earned 100 total points
ID: 9622885
I asume you familiar with JDBC programming and know how to get a resultset from database, and there is what you need to do in your jsp page:
<%
   // jdbc code to get ResultSet from database:
   ResultSet rs = stmt.executeQuery( "select colorid, colordesc from color" );
%>
<select name="col">
<% while( rs.next() ) { %>
<option value='<%=rs.getString(1)%>'><%=rs.getString(2)%></option>
<% } %>
</select>
0
 
LVL 14

Expert Comment

by:kennethxu
ID: 9622919
in case you need information on jdbc programming:
http://java.sun.com/docs/books/tutorial/jdbc/basics/
http://www.javaolympus.com/freebooks/FreeJDBCBooks.jsp

let us know if you have further enquires.
0
 

Author Comment

by:Jasbir21
ID: 9624456
Thank you very much.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Coldfusion 10 - JSP File Not Found - 404 Error 5 115
withoutString  challenge 40 222
designing in object programming 12 129
ejb on wildfly 5 61
After hours on line I found a solution which pointed to the inherited Active Directory permissions . You have to give/allow permissions to the "Exchange trusted subsystem" for the user in the Active Directory...
A big percent of today’s marketing activity is performed through the online environment. The marketing strategies that have existed a decade ago no longer relate to what’s happening today. We’re currently facing a revolutionary era, called the digit…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question