hello ranchers..
here i'm facing a serious problem
this is the table view
------------------------
nameageph
----------------------
aravind23123
prasad24124
chandu25125
rony26126
praveen27127
maya28128
vijesh29129
hunky30130
siva31131
the source code for the
jsp.. is this
<html>
<head>
<title>DOLOGIN
</title>
</head>
<%@ page language="java" session="true" import="java.sql.*" %>
<body>
<form method="POST" name="form1" action="--WEBBOT-SELF--">
<!--webbot bot="SaveResults" U-File="fpweb:///_private/form_results.csv" S-Format="TEXT/CSV" S-Label-Fields="TRUE" -->
<select size="1" name="D1" onchange =xx() >
<option> --Select One--</option>
<%
String age[] = new String[20];
String ph[] = new String[20];
int i=0;
try
{
try
{Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch(ClassNotFoundException e)
{out.println(e);
}
String dbURL = "jdbc
dbc:trial";
Connection dbCon;
dbCon = DriverManager.getConnection(dbURL);
String query = "Select * from table1";
Statement stmt = dbCon.createStatement();
ResultSet rs = stmt.executeQuery(query);
while(rs.next())
{String name = rs.getString(1);
//out.println(name);
%>
<option value="<%=name%>"><%=name%></option>
<%
age[i]= rs.getString(2);
ph[i] = rs.getString(3);
out.println(age[i]);
out.println(ph[i]);
i++;
}
dbCon.close();
stmt.close();
}
catch(SQLException e)
{response.sendRedirect("error.html");
}
%>
</form>
</body>
</html>
<SCRIPT LANGUAGE=javascript>
<!--
function xx()
{//alert("aravind")
alert(document.form1.D1.selectedIndex)
alert(document.form1.D1.value)
alert(age[document.form1.D1.selectedIndex])
}
//-->
</SCRIPT>
the problem what i want to get is..
in the function xx()
i want to get the alert message "age" of the selected one from the combo box..
please help me
egs.. when i select aravind from the combobox..
i can get the index as 1
i can get the value as aravind
but i cannot get the corresponding age to aravind
please help me ranchers